Sha256: bc915923e57d5c5cf0e02e1a2ca92efb4437451bec2a728026afd7694b074eb0

Contents?: true

Size: 356 Bytes

Versions: 7

Compression:

Stored size: 356 Bytes

Contents

module Sufia
  class TrophiesController < ApplicationController
    def toggle_trophy
      work_id = params[:id]
      authorize! :edit, work_id
      t = current_user.trophies.where(work_id: work_id).first
      if t
        t.destroy
      else
        t = current_user.trophies.create(work_id: work_id)
      end
      render json: t
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
sufia-7.4.1 app/controllers/sufia/trophies_controller.rb
sufia-7.4.0 app/controllers/sufia/trophies_controller.rb
sufia-7.3.1 app/controllers/sufia/trophies_controller.rb
sufia-7.3.0 app/controllers/sufia/trophies_controller.rb
sufia-7.3.0.rc3 app/controllers/sufia/trophies_controller.rb
sufia-7.3.0.rc2 app/controllers/sufia/trophies_controller.rb
sufia-7.3.0.rc1 app/controllers/sufia/trophies_controller.rb