>
> 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
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 the Google Groups "Ruby
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to
Thats great!
I am glad you shared this.
--
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+unsubscr...@googlegroups.com.
To post to this
I have to say that Rails is great. 5.1 introduces a wonderful feature for
my need: direct
http://edgeapi.rubyonrails.org/classes/ActionDispatch/Routing/Mapper/CustomUrls.html#method-i-direct
Now in config/routes.rb I can write:
# Content model includes FriendlyId, so
I don't think it is an hack what you are doing.
To actually have routes receiving different types of ids you probably
needed to change how those helpers are generated by rails.
That means you might have to monkey patch rails.
The alternative rails is giving you to be able to do this is by doing
5 matches
Mail list logo