Pick One, Revisited
wants.rss do redirect_to feeds_path(:format => :atom), :status=>:moved_permanently end wants.atom
Pure poetry.
My recommendation remains that you pick one format, and do it right. And, yes, like many things, Rails does have a default and preference.
Before Mikel started, the site in question produced two feeds, and had a number of mistakes in both. Common stuff like date formats, and some fairly rare errors like summary elements (in no namespace) in the RSS feed, and multiple updated elements per entry in the Atom feed.
While his new code is much improved, it can be improved further (and may otherwise cause problems based on the data it is fed):
- Don’t call the
h
helper, builder will effectively do that for you. You don’t want this done twice (not a problem in Rails 3.0 whereh
is effectively a no-op). - If you are calling truncate on something that might contain html tags, what you really want is
truncate(strip_tags(event.description))
xmlns:app
isn’t used, and can be omitted.
One thing I like about Rails is that the HTML it produces is clean. This will see a number of improvements in Rails 3: in particular, it will use the HTML5 doctype, and make use of unubtrusive JavaScript.