hi,
i just started learning how to custimize my urls but i have a few
questions that im sort of unsure about.
first. if i do this.
map.detail "nj/:id"
in my view for controller ''nj'' i can do something like this?
<%= link_to ("show me details", detail_url(something.id)) %>
is this the same as calling link_to like this?
<%= link_to ("show me details", "localhost:3000/nj/" +
something.id) %>
what is the difference between defining map like
map.detail :action => detail, :controller => nj
vs
map.connect "nj/detail" :action => detail, :controller =>
''nj''
--
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
-~----------~----~----~----~------~----~------~--~---
Russell Norris
2007-Feb-15 15:19 UTC
Re: routes,maps, something_url, some simple questions i am sure.
As far as your link_to usage, yes. They''re the same. The named route is easier to maintain codewise but a little slower [at least in the olden days] than writing it out by hand like you do in the second example. The difference between those last map.connect and map.details is 1. map.detailscreates a named route where map.connect doesn''t and 2. You''ll need to add the mapping "nj/:id" to map.detail. RSL On 2/15/07, koloa <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > > hi, > i just started learning how to custimize my urls but i have a few > questions that im sort of unsure about. > > first. if i do this. > > map.detail "nj/:id" > > in my view for controller ''nj'' i can do something like this? > > <%= link_to ("show me details", detail_url(something.id)) %> > > is this the same as calling link_to like this? > > <%= link_to ("show me details", "localhost:3000/nj/" + something.id) %> > > > what is the difference between defining map like > > map.detail :action => detail, :controller => nj > > vs > > map.connect "nj/detail" :action => detail, :controller => ''nj'' > > -- > 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 -~----------~----~----~----~------~----~------~--~---
thanks rsl, its clear now. tried to look up something_url in the rails api, but didnt know what title to look under. wasnt sure if its an extension of url_for. -- 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 -~----------~----~----~----~------~----~------~--~---