Re: [Rails] Re: [QUESTION] How to have different routes ids on different routes for the same resources?

2017-04-21 Thread Maurizio De Santis
> > 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

[Rails] Re: [QUESTION] How to have different routes ids on different routes for the same resources?

2017-04-21 Thread batuhanwilhelm
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

Re: [Rails] Re: [QUESTION] How to have different routes ids on different routes for the same resources?

2017-04-20 Thread André Orvalho
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

[Rails] Re: [QUESTION] How to have different routes ids on different routes for the same resources?

2017-04-20 Thread Maurizio De Santis
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

[Rails] Re: [QUESTION] How to have different routes ids on different routes for the same resources?

2017-04-20 Thread André Orvalho
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