Sha256: 53aa2b90c473953ed7da4d32190f9b43354cbf165ad6844c2c279cd0ad5f03a5

Contents?: true

Size: 435 Bytes

Versions: 1

Compression:

Stored size: 435 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

1 entries across 1 versions & 1 rubygems

Version Path
dismissible_blocks-1.2.0 app/controllers/dismissible_blocks_controller.rb