Dispatches a PartController. Use like:
<%= part TodoPart => :list %>
will instantiate a new TodoPart controller and call the :list action invoking the Part’s before and after filters as part of the call.
returns a string containing the results of the Part controllers dispatch
You can compose parts easily as well, these two parts will stil be wrapped in the layout of the Foo controller:
class Foo < Application
def some_action wrap_layout(part(TodoPart => :new) + part(TodoPart => :list)) end
end
Source Code
# File merb/controller.rb, line 201 def part(opts={}) res = opts.inject([]) do |memo,(klass,action)| memo << klass.new(self).dispatch(action) end res.size == 1 ? res[0] : res end
<code/>and<pre/>for code samples.