I would like to provide Atom feeds in response to different actions.
I am aware that eg map.resources :posts helps me generate a feed
as a request for /posts.:format, but as I am getting into problems,
I see that I do not have the full understanding of what is going on.
I would like to do the same (but with a different dataset) for other
actions such as /posts/today or /posts/yesterday.
For instance, I have created app/views/posts/today.atom.builder file,
and in today.html.erb view I put
<%= auto_discovery_link_tag :atom, url_for(:action =>
''today'') %>
but clicking on the feed icon in Firefox only reloads the html page,
while explicitly requesting posts/today.atom produces:
ActionController::RoutingError (No route matches "/pots/today.atom"
with {:method=>:get})
What am I missing? Should I specify a new named route?
Marko
--~--~---------~--~----~------------~-------~--~----~
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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
Do your actions define a response for atom requests in a respond_to block ? Jan --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Apr 20, 3:15 pm, Jan-Christian Foeh <elektroholun...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Do your actions define a response for atom requests in a respond_to > block ?Currently it looks like: def today # load @posts... respond_to do |format| format.html format.atom end end Marko --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Have you included your additional methods in your routes.rb, as in
map.resources :posts, :collection => { :today => :get, :yesterday
=> :get }
? That should do the trick.
Also, I think the url_for you''re using in auto_discovery_link_tag
lacks the format parameter; I think you can use
formatted_today_posts_url(:atom)
and
formatted_yesterday_posts_url(:atom)
instead.
--~--~---------~--~----~------------~-------~--~----~
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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
On Apr 20, 5:31 pm, Jan-Christian Foeh <elektroholun...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Have you included your additional methods in your routes.rb, as in > > map.resources :posts, :collection => { :today => :get, :yesterday > => :get } > > ? That should do the trick. > > Also, I think the url_for you''re using in auto_discovery_link_tag > lacks the format parameter; I think you can use > > formatted_today_posts_url(:atom) > > and > > formatted_yesterday_posts_url(:atom) > > instead.Thank you, the :collections parameter to map.resources is what it takes. And it gives the formatted_* helpers. Now the API docs are more clear :). Marko --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---