Class: DismissibleBlocksController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/dismissible_blocks_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



2
3
4
5
6
7
8
9
10
11
12
# File 'app/controllers/dismissible_blocks_controller.rb', line 2

def create
  if current_user_available?
    unless current_user.dismissed_blocks.include?(block)
      current_user.dismissed_blocks.push(block)
      current_user.save!
    end
    render json: {}, status: :ok
  else
    render json: {}, status: :unprocessable_entity
  end
end