Displaying 1 result from an estimated 1 matches for "thumbnail_array".
2006 Feb 16
10
Ruby class variables and access from view templates
...app that requires me to define a class variable (actually an
array) in a controller and then access it from within a view. It seems
that the class variables aren''t working right. Here is an example of
what I''m trying to do.
class DisplayController < ApplicationController
@@thumbnail_array = Array.new
...
def some_method
@@thumbnail_array = SomeModel.find_all
...
end
.....
end
Then in the view for some_method,
<% for thumb in @@thumbnail_array %>
...
do something interesting
But my app blows up at that point giving me an unitialized class
variable - @@thumbnail_array....