title: Extracting Ruby code from view into a Helper
body: <p>I have some ruby code in a view and it works great but I know that's not the correct way to do it so want to put it into a helper method (thanks @SimoneCarletti). I'm having some difficulty with that and usually I find people on here 10000x smarter than me who are excellent Rubyists. </p>
  
  <p>Here is the code that I want to put into a helper</p>
  
  <pre><code>product_feed_item.voters_who_voted.map(&amp;:full_name).join(("&lt;br /&gt;").html_safe)
  </code></pre>
  
  <p>Here is the method below in my user model to get the user's product_feed</p>
  
  <pre><code>def product_feed
    Design.from_users_followed_by(self).to_a.concat Product.from_users_followed_by(self).to_a
  end
  </code></pre>
  
  <p>The controller for this view is </p>
  
  <pre><code>@product_feed_items = current_user.product_feed
  @product_feed_items.sort! {|t1, t2| t2.created_at &lt;=&gt; t1.created_at}
  
  respond_to do |format|
    @product_feed_items = @product_feed_items.paginate(:page =&gt; params[:page], :per_page =&gt; 20)
    format.html
    format.json { render json: @product_feed_items }
  end
  </code></pre>
  
  <p>and the View is </p>
  
  <pre><code>&lt;%= render partial: "shared/product_feed_item", collection: @product_feed_items %&gt;
  </code></pre>
  
  <p>Where the partial contains the first block of code I want to extract into a method.</p>
  
  <p>How can I put this into a method?? If you need me to clarify or add anything to help please just let me know. </p>
  
  <p>Thanks in advance for helping! Happy Holidays!</p>