Class: Admin::Blog::CommentsController
- Inherits:
-
BaseController
- Object
- BaseController
- Admin::Blog::CommentsController
- Defined in:
- app/controllers/admin/blog/comments_controller.rb
Instance Method Summary collapse
Instance Method Details
#destroy ⇒ Object
14 15 16 17 18 |
# File 'app/controllers/admin/blog/comments_controller.rb', line 14 def destroy @comment.destroy flash[:success] = 'Comment deleted' redirect_to :action => :index end |
#index ⇒ Object
6 7 8 9 10 11 12 |
# File 'app/controllers/admin/blog/comments_controller.rb', line 6 def index @comments = if @post = @blog.posts.where(:id => params[:post_id]).first @post.comments.page(params[:page]) else @blog.comments.page(params[:page]) end end |
#toggle_publish ⇒ Object
20 21 22 |
# File 'app/controllers/admin/blog/comments_controller.rb', line 20 def toggle_publish @comment.update_attribute(:is_published, !@comment.is_published?) end |