title: Accessing Instance Variables
body: <p>I am just looking to seek some clarification to accessing Instance variables within its class (apologies if this is really basic). </p>
  
  <p>My example is that  I have a recipe controller and within it I have many actions but in paticular I have an INDEX and a SHOW action</p>
  
  <pre><code>def index
  @q = Recipe.search(params[:q])
  @q.build_condition
  end
  </code></pre>
  
  <p>@q searches my Recipe model based on the params passed through my search form</p>
  
  <p>i want to show the results on a different page to start (will look at AJAX option later), so in my SHOW action could I do this</p>
  
  <pre><code> def show
   @searchresults = @q.result(:distinct =&gt; true)
   end
  </code></pre>
  
  <p>I think this is valid but if not I am going wrong somewhere. Can anyone advise or offer some constructive advice?</p>
  
  <p>Thank you</p>