This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
| name | age | message | |
|---|---|---|---|
| |
MIT-LICENSE | Wed Nov 26 09:24:14 -0800 2008 | |
| |
README | Wed Nov 26 10:15:16 -0800 2008 | |
| |
init.rb | Wed Nov 26 09:24:14 -0800 2008 | |
| |
lib/ | Wed Nov 26 10:07:24 -0800 2008 | |
| |
test/ | Wed Nov 26 10:15:16 -0800 2008 |
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







