Sha256: 0e2f8ae25faf973ebedc04ce083f41883d8b0eb458b83b5d753fbf56566b9108

Contents?: true

Size: 714 Bytes

Versions: 4

Compression:

Stored size: 714 Bytes

Contents

require_dependency "hide_and_seek/application_controller"

module HideAndSeek
  class ItemsController < ApplicationController
    before_filter :determine_identifier

    def show
      respond_to do |format|
        format.json {
          render json: [display: $hide_and_seek.display?(params[:id], @id)]
        }
      end
    end

    def update
      respond_to do |format|
        format.json do
          if $hide_and_seek.hide(params[:id], @id)
            render status: 200, json: [true]
          else
            render status: 502, json: [false]
          end
        end
      end

    end

    private
    def determine_identifier
      @id = params[:user_id] || current_user.id
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
hide_and_seek-0.0.4 app/controllers/hide_and_seek/items_controller.rb
hide_and_seek-0.0.3 app/controllers/hide_and_seek/items_controller.rb
hide_and_seek-0.0.2 app/controllers/hide_and_seek/items_controller.rb
hide_and_seek-0.0.1 app/controllers/hide_and_seek/items_controller.rb