Home > merb_component

merb_component

Merb_component is a project mainly written in Ruby, based on the MIT license.

Merb plugin that provides composition of controllers.

merb_component

Merb plugin that provides composition of controllers.

Example of use:

In config/router.rb:

resources :posts do |post|
  post.aggregates :comments
end
resource :admin, :controller => :admin do |admin|
  admin.aggregates :comments
end

In controllers:

class Posts < Application
  aggregates :comments

class Admin < Application
  aggregates :show => :comments

In views:

Content of the user (id is 2) goes here
<%= component :users, :show, :id => 2 %>

For detail, you can see spec/fixture as an example.

Enjoy!

Genki Takiuchi

Previous:growl-glue