public
Description: Support :acts_as in rails/merb routing.
Homepage:
Clone URL: git://github.com/hungrymachine/acts_as_routing.git
name age message
file MIT-LICENSE Loading commit data...
file README
file init.rb
directory lib/
directory test/
README
ActsAsRouting
=============

This plugin allows you to define a generic block of routing logic in a plugin and then apply it to multiple resources in 
your routes file.


Rails Example
============

  # in acts_as_commentable plugin
  ActionController::Routing.routes_for_acts_as(:commentable) do |map|
    map.resources :comments
    map.best_comment '/best-comment', :controller => 'comments', :action => 'best'
  end

  # in acts_as_reviewable plugin
  ActionController::Routing.routes_for_acts_as(:reviewable) do |map|
    map.resources :reviews
  end

  # in config/router.rb
  ActionController::Routing::Routes.draw do |map| 
    map.resources :people, :acts_as => [:commentable, :reviewable]
  end

  # in some view
  <%=person_comments_path(Person.first)%>
  <%=person_reviews_path(Person.first)%>
  <%=person_best_comment_path(Person.first)%>


Merb Example
============

  # in acts_as_commentable plugin
  Merb::Router.routes_for_acts_as(:commentable) do |map|
    map.resources :comments
    map.match('/best-comment').to(:controller => 'comments', :action => 'best').name(:best_comment)
  end

  # in acts_as_reviewable plugin
  Merb::Router.routes_for_acts_as(:reviewable) do |map|
    map.resources :reviews
  end

  # in config/router.rb
  Merb::Router.prepare do
    resources :people, :acts_as => [:commentable, :reviewable]
  end

  # in some view
  <%=url(:person_comments, :person => Person.first)%>
  <%=url(:person_reviews, :person => Person.first)%>
  <%=url(:person_best_comment, :person => Person.first)%>


Copyright (c) 2008 HungryMachine, released under the MIT license