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

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

  private

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

    def block
      params[:block].to_s
    end
end

Check if block already saved
Check if block already saved

Prevent dismissed block from being saved multiple times.
