I’ve read official guide but still have misunderstanding.
Is this code able for refactoring?
match '/help', :to => 'home#help'
match '/contact', :to => 'home#contact'
match '/about', :to => 'home#about'
help, contact and about are the only actions in the controller home.
I did this on a hunch and it’s not mentioned in the documentation, but it looks like it works (I’m on rails 3.1):
This also creates the
help_url,help_path, etc helpers.One warning though, this restricts the http verbs to
GET. If you have aPOSTaction (as an example, for a contact form), you could do either:or just:
which will allow all http verbs on the contact route. But I find it better to be explicit about the accepted verbs.