logo       

[Rails] Re: Trouble understanding Routes: msg#03253

RubyonRailsTalk

Subject: [Rails] Re: Trouble understanding Routes


map.resources

This is the same thing as stating that you have a RESTful controller
setup and that you have paths in place for all 7 controller methods
(index, show, new, edit, create, update, and destroy).

map.connect ':controller/:action/:id'
map.connect ':controller/:action/:id.:format'

This allows you to have urls in place for..

http://yourdomain.com/controller/action/id OR
http://yourdomain.com/controller/id/action etc.

If you haven't modified how your routing and paths are going to behave
in each of your controllers then you want to make sure those two lines
are always at the very bottom of the your routes file. Routes have
precedence in place for their order.

If you want to use javascript in your routes you would place something
like this:

map.js ':controller/:action.:format'

.. at the very bottom as well.

If you wanted a catchall routes type of path set you can set the
following at the bottom:

map.connect "*anything", :controller => 'controllername', :action =>
'request_error'

.. just an example ..

You should check out:

http://guides.rubyonrails.org/routing.html

--
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@xxxxxxxxxxxxxxxx
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe@xxxxxxxxxxxxxxxx
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Google Custom Search

News | Mail Home | sitemap | FAQ | advertise