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


2010/9/30 Lasse <[email protected]>

> class Feeds
>  FEEDS = %W(
>    http://feed.kennisnet.nl/Basisonderwijs
>    http://feed.kennisnet.nl/Voortgezetonderwijs
>    http://wp.digischool.nl/nieuws/feed/
>  )
>
>  def load_feeds
>    @feeds_ds = feeds.first
>    @feeds = vopo? ? feeds.second : feeds.last
>  end
>
>  def feeds
>    @feeds ||= Feedzirra::Feed.fetch_and_parse(FEEDS).values.map { |
> feed| feed.entries.first(6) }.entries
>  end
>
>  def vopo?
>    params[:vopo] == 'po'
>  end
> end
>
>
> 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 = Feeds.new
> f::feeds
> f::load_feeds
> end
>
> 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.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<rubyonrails-talk%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to