Sha256: 7e85bab241d22fa1000270a2b28a1c514cf9a637802872aed2c0c5e36366b697

Contents?: true

Size: 845 Bytes

Versions: 8

Compression:

Stored size: 845 Bytes

Contents

module Jabe
  class CommentsController < Admin::BaseController
    layout 'application'
    skip_before_filter :authenticate_admin!, :only => [ :create, :new ]
    helper_method :entry, :comment

    def create
      if comment.save
        comment.send_notification(request)
        redirect_to entry_path(entry), :notice => 'Your comment was submitted.'
      else
        flash[:error] = 'Unable to submit your comment.'
        render 'entries/show'
      end
    end

    def destroy
      comment.destroy
      redirect_to entry_path(entry), :notice => 'Comment was deleted.'
    end

    private

      def entry
        @entry ||= Entry.find(params[:entry_id])
      end

      def comment
        @comment ||= params[:id].blank? ?
          entry.comments.new(params[:comment]) :
          Comment.find(params[:id])
      end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
jabe-0.8.0 app/controllers/jabe/comments_controller.rb
jabe-0.7.0 app/controllers/jabe/comments_controller.rb
jabe-0.6.5 app/controllers/jabe/comments_controller.rb
jabe-0.6.4 app/controllers/jabe/comments_controller.rb
jabe-0.6.3 app/controllers/jabe/comments_controller.rb
jabe-0.6.2 app/controllers/jabe/comments_controller.rb
jabe-0.6.1 app/controllers/jabe/comments_controller.rb
jabe-0.6.0 app/controllers/jabe/comments_controller.rb