Ruby on Rails
Friday, April 21, 2017
resources :posts, param: :slug
FWIK this just changes the name of the parameter passed to the controller, so if you write post_path(Post.first) you will have a request like /posts/#{post.to_param} but in the controller instead of have param[:id] you have param[:slug]
--
Maurizio De Santis
Maurizio De Santis
2017-04-20 22:27 GMT+02:00 <batuhanwilhelm@gmail.com>:
You can also do something like this If i get it right,
resources :posts, param: :slug
--
You received this message because you are subscribed to a topic in the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/rubyonrails-talk/ .rneoBmxG4QY/unsubscribe
To unsubscribe from this group and all its topics, send an email to rubyonrails-talk+unsubscribe@googlegroups.com .
To post to this group, send email to rubyonrails-talk@googlegroups.com .
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/ .ffd0916e-d658-4cb9-b24f- c4b3ebb52454%40googlegroups. com
For more options, visit https://groups.google.com/d/optout .
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CA%2B_M_Jdcs3E51oQfc%2BAQpBbr%3D3KO9kMZOGn04pu2ATsUQUe_0A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment