« Return to Thread: Only One Controller + Urgent

Re: Only One Controller + Urgent

by Adam Akhtar-2 :: Rate this Message:

Reply to Author | View in Thread


First, how are you creating these controllers?  Are you creating them
RESTfully?  Are you using generate controller or generate scaffold?

If you are generating via scaffold then inside your routes.rb file
you'll see something like:

map.resources :controller

Mapping is what creates the routes for this.  Keep in mind that at the
bottom of that file you may have:

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

These two lines basically setup the controller, action, id routing to
every controller you create.  If you don't want these to manage those
routes you need to comment them out:

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

Then, you setup explicit routing using the examples I gave.  If you are
having trouble with routes then you need to research them a bit and get
familiar with them.  They are very important for working with rails:

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@...
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

 « Return to Thread: Only One Controller + Urgent