Rails 3 resource routing without an id -


I am making a blog application on Rail 3, and I want to override the default show route ready for a post

  Resources: Post, Excluding => & gt; : Show   

The show generates for the root (I did not put it out),

  / post /: id   

I want to show my path instead, where url_title is the string generated by my model at first_service, where it removes non-alphanumeric characters and changes the space with hyphens.

  /:   

I'm trying to complete it with a bit of code:

  match "/: Year / year /: / day /: day /: url_title : month /: day /: url_title",: to = & gt; "Post #Show",: Like = & gt; In theory, I should allow post-path (@post) (where post is an example of my post class), and be able to sort this route. And it  works around   

The only problem is that he tries to transfer the post ID for the year. Fill out the other fields correctly I think this is happening because the rail has some default behavior that it actually makes, actually want to place an ID in the URL, and this is my own unique identifier (post in this case. Ur_title). / P>

While I may be wrong about this, any person has experience with such routing, or know what is happening?

use of rail

  class posts & lt; More information: and < / P> 

If you go this route, you want to create an atom's attribute, and instead of Post.find () Post.find_by_permalink (params [: id] < / Code>). Param [: id])

Comments