|
[Rails] Re: Trouble understanding Routes: msg#03275RubyonRailsTalk
Thanks for the responses. I think I understand it now so I'll recap real quick // Routes get written in a priority order. Specialized routes on the top (in this case assuming a RESTful manner from the controllers) map.resources :users map.resource :session map.resources :stories, :has_many => :votes, :collection => { :bin => :get } // And the default layout for all routes not specifically set above map.root :controller => "stories" map.connect ':controller/:action/:id' map.connect ':controller/:action/:id.:format' Thanks again, brianp On Jul 31, 7:51 am, Alpha Blue <rails-mailing-l...@xxxxxxxxxxxxx> wrote: > 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/idORhttp://yourdomain.com/controller/id/actionetc. > > 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 yourroutesfile. Routeshave > precedence in place for their order. > > If you want to use javascript in yourroutesyou would place something > like this: > > map.js ':controller/:action.:format' > > .. at the very bottom as well. > > If you wanted a catchallroutestype 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 viahttp://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 -~----------~----~----~----~------~----~------~--~---
|
|
||||||||||||||||||||||||||
|
|
|
| News | Mail Home | sitemap | FAQ | advertise |