Accessing the values in a view


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'


and in the archive.rhtml

<%= @archives %>

but i get nothing? shouldn’t i be able to access @archives?


matthew collins wrote:

@archives = ‘test’

Your archive method should be something like:

def archive
@archives = ‘test’
render(:layout => false)

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