Skip to content

Commit

Permalink
Merge branch 'patch-1' of https://github.com/amalagaura/apotomo
Browse files Browse the repository at this point in the history
  • Loading branch information
apotonick committed Jan 3, 2012
2 parents 0a3a122 + a7c23c6 commit 6e8d1a2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions README.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ You now tell your controller about the new widget.
include Apotomo::Rails::ControllerMethods

has_widgets do |root|
root << widget('comments_widget', 'post-comments', :post => @post)
root << widget('comments_widget', :post => @post)
end

The widget is named <tt>post-comments</tt>. We pass the current post into the widget - the block is executed in controller instance context, that's were <tt>@post</tt> comes from. Handy, isn't it?
This creates a widget instance called <tt>comments_widget</tt> from the class CommentsWidget. We pass the current post into the widget - the block is executed in controller instance context, that's were <tt>@post</tt> comes from. Handy, isn't it?

== Render the widget

Expand All @@ -77,7 +77,7 @@ Rendering usually happens in your controller view, <tt>views/posts/show.html.ham
@post.body

%p
= render_widget 'post-comments'
= render_widget 'comments_widget'

== Write the widget

Expand Down

0 comments on commit 6e8d1a2

Please sign in to comment.