public
Description: SEO Plugin for Ruby-on-Rails to enable more compact routes by declaring a nested resource as the default.
Homepage: http://caring.lighthouseapp.com/projects/12742-default_routing
Clone URL: git://github.com/caring/default_routing.git
commit  2b767cb106892582a1023df1812be5147df75a71
tree    72b7d08e0f91bdc79713562e3952cfc855e5ceeb
parent  fccec9c0476bb76950df64425dfc9a29aa30f0b6
name age message
file MIT-LICENSE Thu Jun 12 16:57:11 -0700 2008 initial release [chriseppstein]
file README Loading commit data...
file Rakefile
file init.rb
directory lib/
directory test/
README
DefaultRouting
==============

This is an SEO Optimization plugin that allows you to specify that one or more nested routes will not have
a path segment added to their url.

When combined with acts_as_url_param (or some other pretty url plugin), this results in nice tight urls without any 
extra folders in them in the cases where you can safely get away with it.

It's important to note that using a default nesting results in a url collision that hides the index action of the nested 
resource. This is usually fine, because the show action of the parent resource can and should acts as the index page, 
and in some cases is desirable so that you don't have to remember which named route to use.

Example
=======

map.namespace :forum do |forum|
  forum.resources :boards, :default => true do |boards|
    boards.resources :threads, :default => true do |threads|
      threads.resources :posts, :default => true
    end
  end
end

% rake routes | grep forum | grep -v format

                forum_boards GET    /forum
                             POST   /forum
             new_forum_board GET    /forum/new
            edit_forum_board GET    /forum/:id/edit
                 forum_board GET    /forum/:id      << prevents recognition of forum_board_threads
                             PUT    /forum/:id
                             DELETE /forum/:id
         forum_board_threads GET    /forum/:board_id
                             POST   /forum/:board_id
      new_forum_board_thread GET    /forum/:board_id/new
     edit_forum_board_thread GET    /forum/:board_id/:id/edit
          forum_board_thread GET    /forum/:board_id/:id      << prevents recognition of forum_board_thread_posts
                             PUT    /forum/:board_id/:id
                             DELETE /forum/:board_id/:id
    forum_board_thread_posts GET    /forum/:board_id/:thread_id
                             POST   /forum/:board_id/:thread_id
 new_forum_board_thread_post GET    /forum/:board_id/:thread_id/new
edit_forum_board_thread_post GET    /forum/:board_id/:thread_id/:id/edit
     forum_board_thread_post GET    /forum/:board_id/:thread_id/:id
                             PUT    /forum/:board_id/:thread_id/:id
                             DELETE /forum/:board_id/:thread_id/:id

% script/console
>> app.forum_board_thread_post_path(Board.first, Thread.first, Post.first)
=> "/forum/star-wars/droids/r2d2-rocks-c3po-sucks"

Copyright (c) 2008 Chris Eppstein, released under the MIT license