views:

107

answers:

1

Hi,

I need several RSS feeds in my app. They are in a way similar to existing actions but with less options (no will_paginate, no sorting, only the most recent 20 results). So for example I have one action which shows all items tagged "amazing" and I also need one feed which shows the latest items tagged "amazing".

My question: Is it better practice to create a FeedsController with a "tag" action (that's what I'm doing now, it seems more clean to me) OR use respond_to in the TagsController's "show" action to do the slightly different find and serve the rss template? With the latter approach I would have both in one action but it's less clean.

What's your opinion?

Thanks!

+1  A: 

I use the latter approach (respond_to) because it is cleaner IMHO. An RSS feed is just an alternative representation of the same resource. Use a named scope to encapulate the find differences.

John Topley
That's what I thought too, the action is the same, the controller should be the same too, only the view is different. On the other hand I'm performing some other actions and retrieve other information from the DB (like related items) which isn't necessary for the feed. So maybe my case is different. Thanks. Other opinions?
ole_berlin