Sha256: efe6282964af51ad49706ac8589e565965b2bb8793b2d2cd3640ce064c936ceb

Contents?: true

Size: 754 Bytes

Versions: 9

Compression:

Stored size: 754 Bytes

Contents

class Admin::Blog::CommentsController < Admin::Blog::BaseController
  
  before_filter :load_post,     :only => [:index]
  before_filter :load_comment,  :only => [:destroy, :publish]
  
  def index
    @comments = @post ? @post.comments : Blog::Comment.all
  end
  
  def destroy
    @comment.destroy
  end
  
  def publish
    @comment.update_attribute(:is_published, true)
  end
  
protected
  
  def load_post
    return unless params[:post_id]
    @post = Blog::Post.find(params[:post_id])
  rescue ActiveRecord::RecordNotFound
    flash[:error] = 'Blog Post not found'
    redirect_to :action => :index
  end
  
  def load_comment
    @comment = Blog::Comment.find(params[:id])
  rescue ActiveRecord::RecordNotFound
    # ... do nothing
  end
  
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
comfy_blog-0.1.8 app/controllers/admin/blog/comments_controller.rb
comfy_blog-0.1.7 app/controllers/admin/blog/comments_controller.rb
comfy_blog-0.1.6 app/controllers/admin/blog/comments_controller.rb
comfy_blog-0.1.5 app/controllers/admin/blog/comments_controller.rb
comfy_blog-0.1.4 app/controllers/admin/blog/comments_controller.rb
comfy_blog-0.1.3 app/controllers/admin/blog/comments_controller.rb
comfy_blog-0.1.2 app/controllers/admin/blog/comments_controller.rb
comfy_blog-0.1.1 app/controllers/admin/blog/comments_controller.rb
comfy_blog-0.1.0 app/controllers/admin/blog/comments_controller.rb