Rails Routing is defined in ./config/route.rb. Routings are actually a list of rules.
Routing has two purposes.
- Recognize URL: What to do when an URL like http://localhost:3000/myrecipes/applesis coming.
- Generate URL: What to create when Rails command like
link_to :controller=>'recipes',
:action=>'show',
:ingredient=>'apple'
is defined.
The static text is myrecipes.
The wildcard receptor is :ingredient which you can get by
params[:ingredient]
No comments:
Post a Comment