I've decided to rewrite some code in my datasets branch to take
advantage of Rails 2's ability to automatically infer routes from a
given object (for example 'link_to(@object.name, @object')).
However, it can't figure out what to do with instances of Blob and
Network as, the resources described in the routes file are named
"Files" and "Groups" respectively.
To solve this, rather than having: "resources :files, :controller =>
:blobs..."
you can use: "resources :blobs, :as => :files..."
which would maintain the same functionality/URL paths as the one
above, and Rails would know that its the route for the "Blob" model.
This has the advantage of allowing things that deal with heterogeneous
sets of resources to be able to generate links to resources without
needing switch statements.
The major issue is, all instances of "file_path(@file.id)" etc. would
have to be replaced with "blob_path(@file.id)". As far as I can tell,
there isn't a way to avoid this.
I'd like to hear peoples' thoughts on this.
-Finn