How to use a class, put it inside a model?

class Feeds
  FEEDS = %W(

  def load_feeds
    @feeds_ds = feeds.first
    @feeds = vopo? ? feeds.second : feeds.last

  def feeds
    @feeds ||= Feedzirra::Feed.fetch_and_parse(FEEDS) { |
feed> feed.entries.first(6) }.entries

  def vopo?
    params[:vopo] == 'po'

This is my class.
I would like to display the feeds on every page. Where should i put
it? in a model or controller?
and how doe i use it?

def load_feeds
f =

This is what my view looks like

<%- for feed in @feeds[0..2] -%>
<%= link_to feed.title, feed.url -%>
<p><%=h feed.summary[0..60] %>...</p></li>
<%- end -%>

Thank you in advance.

I would probably put the class in a file inside lib/ folder and add a helper for displaying the feeds.

<%= feeds_list %>

Daniel Gaytán

1) you should not put it into the any controller, controllers have
another purpose, in controller you should only call feeds loading from
some other class.
2) I agree to Daniel, you may put it into the lib/ folder or into app/
3) The whether should you have a helper or not for rendering this part
of the view depends on the whether will you call it from the different
places of views (then you definitely should have a helper), or you'll
have only one place in say some main layout where you render it then
there is no need in helper
4) If you want to see feeds within all your pages you should put the
collecting method (load_feeds) into some private/protected method of
ApplicationController and then use it as before_filter in your
controllers (don't forget to turn it off for e.g. destroy method when
you don't need it)
5) you should pass params[:vopo] to your class as some parameter since
it's part of controller
6) If you need just to fetch the feeds once per page I'd put the feeds
loading into some static method, and later call it just like (my_feeds
= Feed.load_feeds), if you need to use them in several places you may
also use Singleton pattern (