Class: SofaBlog::Admin::CommentsController
- Inherits:
-
BaseController
- Object
- BaseController
- SofaBlog::Admin::CommentsController
- Defined in:
- app/controllers/sofa_blog/admin/comments_controller.rb
Instance Method Summary collapse
- #approve ⇒ Object
- #create ⇒ Object
- #destroy ⇒ Object
- #disapprove ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#approve ⇒ Object
47 48 49 |
# File 'app/controllers/sofa_blog/admin/comments_controller.rb', line 47 def approve @comment.approve! end |
#create ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'app/controllers/sofa_blog/admin/comments_controller.rb', line 19 def create @comment.save! flash[:notice] = 'Comment created' redirect_to :action => :index rescue ActiveRecord::RecordInvalid flash.now[:error] = 'Failed to create Comment' render :action => :new end |
#destroy ⇒ Object
41 42 43 44 45 |
# File 'app/controllers/sofa_blog/admin/comments_controller.rb', line 41 def destroy @comment.destroy flash[:notice] = 'Comment removed' redirect_to :action => :index end |
#disapprove ⇒ Object
51 52 53 |
# File 'app/controllers/sofa_blog/admin/comments_controller.rb', line 51 def disapprove @comment.disapprove! end |
#edit ⇒ Object
28 29 30 |
# File 'app/controllers/sofa_blog/admin/comments_controller.rb', line 28 def edit render end |
#index ⇒ Object
7 8 9 |
# File 'app/controllers/sofa_blog/admin/comments_controller.rb', line 7 def index @comments = SofaBlog::Comment.order('created_at DESC') end |
#new ⇒ Object
15 16 17 |
# File 'app/controllers/sofa_blog/admin/comments_controller.rb', line 15 def new render end |
#show ⇒ Object
11 12 13 |
# File 'app/controllers/sofa_blog/admin/comments_controller.rb', line 11 def show render end |
#update ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'app/controllers/sofa_blog/admin/comments_controller.rb', line 32 def update @comment.update_attributes(params[:comment]) flash[:notice] = 'Comment updated' redirect_to :action => :index rescue ActiveRecord::RecordInvalid flash.now[:error] = 'Failed to update Comment' render :action => :edit end |