Rick wrote:
> On Fri, Jul 3, 2009 at 11:16 PM, Matt
> Harrison<[email protected]> wrote:
> 
>> You can add that above line and then run "rake routes" to list the
>> structure. The new routes generate buy the line will be shown and should
>> let you see what it does.
> 
> Awesome. Thanks so much! I had created the other pages using the
> scaffolding (which explains those entries in the routes.rb) but not
> for this one (matches) which I manually started to make. Scaffolding
> is nice but learn so much more from these mistakes doing it yourself
> that you helped me with . Thanks again.

Yep, scaffolding is one of those things everyone, including myself - 
finds out about later on.  Then there's always some unloved MVC that 
gets forgotten in the shuffle.  Again, glad you got everything working 
out.

Routing is very important and one of the intricate parts of rails.

You can also limit your routing for each of those scaffolds by doing 
something similar:

Say you want to restrict the route only to the index and you have 
RESTful methods in each of your scaffolds.. you can do :

  map.resources :name_of_controller, '/route'

You can also name specific routes/custom actions by..

  map.name_of_route :name_of_route, :controller => 'name_of_controller', 
:action => 'custom_method'

And, you can also further provide a catchall route for anything not 
specified in your routes by doing the following:

  map.connect "*anything", :controller => 'your_controller', :action => 
'request_error_page'

Place this one at the very bottom of your routes and create a custom 
view named request_error_page.html.erb and you can intercept anything 
that's out of scope.

Routing is also important with where you place things.  For instance, 
this last line if you placed it at the top of your routes file, it would 
catch everything and none of your other routes would work.

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

Reply via email to