Hi, I can''t seem to find how to define the format in my links. My link looks like this now: <%= link_to ''Show'', resource_path(@resource) %> But how do I specify the format? Do I realy need to create the url myself? Thank you in advance. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
resource_path(@resource, :format => :xml) On Sun, May 25, 2008 at 9:46 PM, Michael Rigart < rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Hi, > > I can''t seem to find how to define the format in my links. My link looks > like this now: > > <%= link_to ''Show'', resource_path(@resource) %> > > But how do I specify the format? Do I realy need to create the url > myself? > > Thank you in advance. > -- > Posted via http://www.ruby-forum.com/. > > > >-- Appreciated my help? Recommend me on Working With Rails http://workingwithrails.com/person/11030-ryan-bigg --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Ok, I thought is was this way. But how can I get the url format like xxx.xml and not like xxx?format=xml ? I have map.connect '':controller/:action/:id.:format'' specified in my routes.rb Thank you for the quick reply btw -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
if you do rake routes you should see there are a bunch of additional routes like formatted_resource_path you can use those to specify a path to an xml, rss etc file e.g. link_to(''Show XML'', formatted_resource_path(@resource, :format => :xml)) Think that should work... Joe On May 25, 1:34 pm, Michael Rigart <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Ok, I thought is was this way. But how can I get the url format like > > xxx.xml and not like > > xxx?format=xml ? > > I have > > map.connect '':controller/:action/:id.:format'' > > specified in my routes.rb > > Thank you for the quick reply btw > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---