ruby - Custom routes in Rails -
I am trying to create some good links on my website. I'm just making a search through tags, and I wonder if it is possible to create some good ways in this way:
http://myapp.com/search/ A_very http: /mymyp.com/search/nice_set http://myapp.com/search/of_tags
or at least:
< Code> http: // Myapp.com/articles/search/a_very http://myapp.com/articles/search/nice_set http://myapp.com/articles/search/of_tags< P> I did some experiment with link_for , and find out that it is impossible to avoid action? Parameter = Value Building There I am also trying to avoid any 'number stuff' in the address, such as sending an ID between actions etc. Even then, I'm just starting one and I do not know at all which direction I should dig.
Should it be some way magic? How to apply that magic to my example? Are I Broking 'Conference of Configuration'?
It should not require "magic"; This is a pretty standard type of route you can do (in routes.rb)
map.tag_search "search /: tag",: admin = & gt; "Tag",: action => "Search"
The above assumes that you have a tag controller with search operation. Inside that action, the end [URL] of your URL will be available in the Ultimate [[tags].
I recommend reading this - it involves this scenario and many others.
Comments
Post a Comment