Class: Admin::CommentsController
- Inherits:
-
BaseController
- Object
- BaseController
- Admin::CommentsController
- Defined in:
- app/controllers/admin/comments_controller.rb
Instance Method Summary collapse
Instance Method Details
#destroy ⇒ Object
31 32 33 34 35 36 |
# File 'app/controllers/admin/comments_controller.rb', line 31 def destroy @comment.destroy trigger_events @comment flash[:notice] = t(:'adva.comments.flash.destroy.success') redirect_to params[:return_to] || admin_comments_url end |
#edit ⇒ Object
17 18 |
# File 'app/controllers/admin/comments_controller.rb', line 17 def edit end |
#index ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'app/controllers/admin/comments_controller.rb', line 8 def index # FIXME how to remove the Topic dependency here? # maybe make Comment a subclass of Comment::Base or something so that we can use STI to exclude # special comment types? @comments = @site.comments.where(['commentable_type NOT IN (?)', 'Topic']). reorder("comments.created_at DESC"). paginate(:page => current_page, :per_page => 25) end |
#update ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'app/controllers/admin/comments_controller.rb', line 20 def update if @comment.update params[:comment] trigger_events @comment flash[:notice] = t(:'adva.comments.flash.update.success') redirect_to params[:return_to] || admin_comments_url else flash.now[:error] = t(:'adva.comments.flash.update.failure') render :action => :edit end end |