Forums » Development »
Difference between using query and @query in views/_list.html.erb
Added by Olivier Houdas almost 10 years ago
Hi,
This is just a curiosity question about programming with Ruby on Rails...
In app/views/_list.html.erb, there are references to @query, but also to query.
According to Ruby variable naming, @query is an instance variable, and query is a local variable.
querycomes from the call:<%= render :partial => 'issues/list', :locals => {:issues => @issues, :query => @query} %>
in views/issues/index.html.erb
@querycomes from the issues controller itself
So I was wondering,
1. If we modify query, will it modify @query?
2. Why do we want to use the local query variable for calls to column_header() and to column_content() (queries_helper), which, in principle, should not modify the object?
Thank for helping me fulfill my curiosity :)
Olivier