title: NameError in Static_pages#home, undefined local variable or method `activity'
body: <p>I'm using the PublicActivity ruby gem and I'm getting this error message</p>
  
  <p>This is happening inside <code>/views/activities/_index.html.erb</code></p>
  
  <pre><code>&lt;li&gt;
  
    &lt;% if activity.trackable_type == "Micropost" %&gt;
       &lt;%= link_to activity.owner.name, activity.owner if activity.owner %&gt; posted
    &lt;% else %&gt;
     &lt;%= link_to activity.owner.name, activity.owner if activity.owner %&gt; made a comment on &lt;%= link_to activity.recipient_id %&gt;
    &lt;% end %&gt;
  
  &lt;/li&gt;
  </code></pre>
  
  <p>However, when I include this line, it works fine</p>
  
  <pre><code>&lt;li&gt;
  &lt;% @activities.each do |activity| %&gt;
    &lt;% if activity.trackable_type == "Micropost" %&gt;
       &lt;%= link_to activity.owner.name, activity.owner if activity.owner %&gt; posted
    &lt;% else %&gt;
     &lt;%= link_to activity.owner.name, activity.owner if activity.owner %&gt; made a comment on &lt;%= link_to activity.recipient_id %&gt;
    &lt;% end %&gt;
  &lt;% end %&gt;
  &lt;/li&gt;
  </code></pre>
  
  <p>I added <code>&lt;% @activities.each do |activity| %&gt;</code> above. It works without the error but the problem is that, in the view the activities are repeated inside the same list. </p>
  
  <p>This is where the <code>activities/_index.html.erb</code> is getting called</p>
  
  <p>My <code>views\shared\_feed.html.erb</code></p>
  
  <pre><code>  &lt;%= render partial: 'activities/index', collection: @activities %&gt;
  </code></pre>
  
  <p>My activities controller</p>
  
  <pre><code>class ActivitiesController &lt; ApplicationController
    def index
      @activities = PublicActivity::Activity.order("created_at desc")
      @activity = PublicActivity::Activity.order("created_at desc")
    end
  
  end
  </code></pre>