Sha256: 6bc82b07cfbe73fdadb712b4c554bdf0dba6ef573b926116c94bc667bfc89650

Contents?: true

Size: 447 Bytes

Versions: 2

Compression:

Stored size: 447 Bytes

Contents

class DismissibleBlocksController < ApplicationController
  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

2 entries across 2 versions & 1 rubygems

Version Path
dismissible_blocks-1.1.1 app/controllers/dismissible_blocks_controller.rb
dismissible_blocks-1.1.0 app/controllers/dismissible_blocks_controller.rb