Sha256: d6fae3f7b877d771d4d7e27d759bc27d736219dc6ca116956da5a247661d1c67

Contents?: true

Size: 568 Bytes

Versions: 10

Compression:

Stored size: 568 Bytes

Contents

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

  def create
    if comment.save
      redirect_to entry_path(entry), :notice => 'Your comment was submitted'
    else
      render 'entries/show'
    end
  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

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
jabe-0.5.9 app/controllers/comments_controller.rb
jabe-0.5.8 app/controllers/comments_controller.rb
jabe-0.5.7 app/controllers/comments_controller.rb
jabe-0.5.6 app/controllers/comments_controller.rb
jabe-0.5.5 app/controllers/comments_controller.rb
jabe-0.5.4 app/controllers/comments_controller.rb
jabe-0.5.3 app/controllers/comments_controller.rb
jabe-0.5.2 app/controllers/comments_controller.rb
jabe-0.5.1 app/controllers/comments_controller.rb
jabe-0.5.0 app/controllers/comments_controller.rb