Merb Parts (or) Components in Merb

Merb Parts are analogous to Rails Components, except without the myriad shortcomings. Yehuda Katz gives a good introduction to them on his blog.

A few things not covered in Yehuda’s blog post:

Render A Part’s Action From Another Controller

In the off chance that you want to render a part controller’s action from a controller, you can create an instance of the controller and then call its _dispatch method.

class Nav < Application
  def show
    part = NavPart.new(self)
    render part._dispatch(:action_name)
  end

Edit Page | History | Version: