I have an 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
@@thumbnail_array = SomeModel.find_all
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.
What am I doing wrong?