trying to build an archive page
in the controller layout file, i render_component(:action => “archive”),
and that works fine. i turned render(:layout => false) within the
“archive” function.
trouble is, and here’s my confusion. as a test, i simply write
def archive
render(:layout => false)
@archives = 'test'
end
and in the archive.rhtml
<%= @archives %>
but i get nothing? shouldn’t i be able to access @archives?
matthew collins wrote:
@archives = ‘test’
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails
Your archive method should be something like:
def archive
@archives = ‘test’
render(:layout => false)
end
Call render on the last line, because it prepare view to be viewed!
–
Husein C.,
Software Architect
Try flipping those two statements… If you render before you set the
@archives variable, I wouldn’t imagine it would be available in the
view.