Get SEO friendly URLS with Rails without method_missing? -
Currently we are using method_missing to call SEO operative actions in our controllers instead of each conceivable value Instead of creating tasks for variables What we want, we do the URL in this way:
/ students / bosmith
and no / students / show / 342
what method to enter Is there a cleaner solution than doing?
Thank you!
You can define a route quite easily for that particular look.
map.connect "/ students /: name" ,: Controller => : Students, action = & gt; : Show,: requirements => {: Name = & gt; / [A-Z] [A-Z] + /}
Then you can find names using the name [[name:]] in your show action.
Comments
Post a Comment