title: controller not doing what it should?
body: <p>In my application I have groups which are essentially just tags that can be assigned to different models, through a polymorphic relationship. In model Group I have:</p>
  
  <pre><code>def get_members_of(klass)
    self.group_memberships.delete_if {|gm| gm.groupable_type != klass}.map{|g| g.groupable}
  end
  </code></pre>
  
  <p>So if I did:</p>
  
  <pre><code>group.group_memberships
  </code></pre>
  
  <p>I would get all the objects in group group. However, if I want to limit it to only objects that are instances of model A I would do:</p>
  
  <pre><code>group.get_members_of(A)
  </code></pre>
  
  <p>In the console this works exactly as it should. However, I get some unexpected behaviour within my controller:</p>
  
  <pre><code>def show
    params[:studies1] = @group.get_members_of('Study').length
    @studies = @group.get_members_of('Study')
    params[:studies2] = @studies.length
    @studies = @group.group_memberships.delete_if {|gm| gm.groupable_type != "Study"}.map{|g| g.groupable}
    params[:studies3] = @studies.length
  end
  </code></pre>
  
  <p>As expected params[:studies1] == 1, but studies2 and 3 are == 0. I'm sure I'm missing some small thing...</p>