I have a class Post
I want the default URL of each posts to be http://domain.com/9383 instead of http://domain.com/posts/9383
I tried to fix it in the routes. I manage to accept domain.com/222 but if I use <%= url_for(@posts) %> I still get domain.com/posts/222
How can I do it? Thank you
You can’t change the behaviour of
url_for(@post)with routes.url_forwill assume amap.resourcessetup if anActiveRecordinstance is passed to it.You should rather do this: