experimenting, trying to understand local and instance vars and their
relationship to views
I have a controller with an index method.
it sets a local variable like this: (of course I could just make it an
instance variable here but …)
search_results = Ticket.find(:all, :conditions => session
[:search_conditions]) if session[:search_conditions]
in the index view I say this to show the search results, “result” is
the name of the variable in the partial.
I’m not explicitly setting search_results as an instance variable
anywhere in the controller. But, just putting the @ in front of the
variable name in the index view seems to auto-magically convert local
variable search_results from the index controller method to an
instance variable usable in the index view.
Is that right? That’s just the way it works in Rails 2.2 ?