Rails 2.0 vs. custom routes

Check out the new 'rake routes' command. It'll show you what available routes and helpers you have. Also, check out this sweet cheatsheet:

Your route should look something like this: map.resources :users, :collection => { :expand_all => :get }

And, from your view, you should be doing something like this (assuming you've defined "expand_all" as a collection route as opposed to a singular route):

<%= link_to ''Expand All Users", expand_all_users_path %>

If you've defined your "expand_all" route as singular, then I'd expect to see behavior similar to what you're seeing. If you can't get it working, post your routes.rb file here.

Ah, there's the problem.

Try this:

map.resources :users,     :collection => {         :expand_all => :get      },     :member => {         :say_hello => :get     }

By calling map.resources twice, you're overriding the first one. You have to map each resource as a single call.

I find the RESTful routing very confusing for anything other than the CRUD mode. I can see how GET/PUT/POST/DELETE maps to the controller for that. Its been soooooo well documented and soooooo many examples; I'm almost sick of it.

But many of us aren't doing the kind of model that is in AWDWR, the catalogue/invoice type of thing.

There's a whole class of applications that have a very different front end" Wikis, Games and so forth. Essentially they have one UI because there is only the one conceptual model that that the user sees. (The AWDWR has a catalogue view, a invoice view ....).

Something like Instiki has 26 public methods - that is things that can appear as URLs in buttons. Not all of them fit very obviously into the GPPD approach.

I can squint hard and treat the various print and RSS/Atom as special cases of 'view', all I've really done, as far as I can see, is made my menu button code more complicated.

Instiki also has one shortcoming that is easy to get around. Its urls are of the form   somedomain.com ... to point to the wiki controller. For many domains this is unacceptable. Yes, I know it can be cleaned up with Apache mod_rewrite, but many of us use hosted services and would rather do it with the application - in routes.

So would those Rails-ists experienced in resourceful techniques please help out the rest of us and come up with examples and illustrations that are a little different, that aren't in the CRUD model, that don't require the name of the controller in the URL to do a 1:1 mapping url:controller.

Please, lets see some flexibility rather than the same old same old being repeated. Those who do want the CRUD mode - well there's plenty out there on the 'Net right now, you don't need to add to it with "me too" postings.

Btw, everything in that cheatsheet applies to Rails 2.0.