Sha256: ffba13f86e9b0cebea635d2af880e248e1042c95bfa478a4c1b207e9fb712e3a

Contents?: true

Size: 427 Bytes

Versions: 1

Compression:

Stored size: 427 Bytes

Contents

module DismissibleBlocks::Controller

  def create
    if current_user_available
      current_user.dismissed_blocks += [ params[:block].to_s ]
      current_user.save!
      render :json => {}, :status => :ok
    else
      render :json => {}, :status => :unprocessable_entity
    end
  end

  private

    def current_user_available
      respond_to?(:current_user) && current_user.respond_to?(:dismissed_blocks)
    end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dismissible_blocks-0.0.2 lib/dismissible_blocks/controller.rb