title: Class variable uninitialized error in ruby on rails
body: <p>Here's the code:</p>
  
  <pre><code>class MulticastController &lt; ApplicationController
      @@groups=Array.new
      @@groups=[]
  
      @@group_name=Array.new
      @@group_name=[]
  
      def getResults
          @@groups
          @@group_name
          if request.post?
  
               if params[:creategroup] #makes a new group
                    @@groups &lt;&lt; searchHash
                    @@group_name &lt;&lt; params[:groupname]
  
                    if @@groups.size&gt;5
                        @@groups[0].delete
                        @@group_name[0].delete
                    end
  
               end
  
              if params[:displaygroup] 
                  @@group_name.each_with_index do |gr,i|
                  if(gr==params[:inputgroupname])
                      @results=Person.where(@@groups[i]).to_a
                      render :new_results, :layout =&gt; false
                  end
              end
      end
  </code></pre>
  
  <p>On the views portion I have- </p>
  
  <pre><code>        &lt;div class="span6 service"&gt;
              &lt;legend&gt;Groups&lt;/legend&gt;
              &lt;% group_name.each do|grp|%&gt;
                  &lt;%= grp %&gt;&lt;br&gt;
              &lt;%end %&gt;&lt;br&gt;&lt;br&gt;
              &lt;input type="hidden" name="displaygroup" value="1"&gt;
              &lt;div&gt;
                  &lt;input type="text" name="inputgroupname" value="inputgroupname"&gt;
              &lt;/div&gt;
  </code></pre>
  
  <h2>            </h2>
  
  <p>I dont know what to do, its giving me an " uninitialized class variable @@group_name in ActionView::CompiledTemplates " error.</p>
  
  <p>I want the variables group and group_name to be common to all the instances of multicast. stuck.</p>