I am just looking to seek some clarification to accessing Instance variables within its class (apologies if this is really basic).
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
def index
@q = Recipe.search(params[:q])
@q.build_condition
end
@q searches my Recipe model based on the params passed through my search form
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
def show
@searchresults = @q.result(:distinct => true)
end
I think this is valid but if not I am going wrong somewhere. Can anyone advise or offer some constructive advice?
Thank you