Module: Opinio::Controllers::Helpers
- Defined in:
- lib/opinio/controllers/helpers.rb
Instance Method Summary collapse
- #comments_for(object, options = {}) ⇒ Object
- #render_comments(object, options = {}) ⇒ Object
- #render_comments_form(object, options = {}) ⇒ Object
Instance Method Details
#comments_for(object, options = {}) ⇒ Object
5 6 7 8 |
# File 'lib/opinio/controllers/helpers.rb', line 5 def comments_for(object, = {}) render_comments(object, ) + ( render_comments_form(object, ) unless [:no_new] ).to_s end |
#render_comments(object, options = {}) ⇒ Object
10 11 12 13 14 |
# File 'lib/opinio/controllers/helpers.rb', line 10 def render_comments(object, = {}) limit = .delete(:limit) || Opinio.model_name.constantize.default_per_page page = .delete(:page) || 1 render( :partial => "opinio/comments/comments", :locals => {:comments => object.comments.page(page).limit(limit), :commentable => object, :options => } ) end |
#render_comments_form(object, options = {}) ⇒ Object
16 17 18 |
# File 'lib/opinio/controllers/helpers.rb', line 16 def render_comments_form(object, = {}) render( :partial => "opinio/comments/new", :locals => {:commentable => object, :options => } ) end |