Sha256: 44087547a10a1e3629d61c97180adb22b47e16551529d65da48b606f3066c2fa

Contents?: true

Size: 356 Bytes

Versions: 1

Compression:

Stored size: 356 Bytes

Contents

module Hyrax
  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

1 entries across 1 versions & 1 rubygems

Version Path
test_hyrax-0.0.1.alpha app/controllers/hyrax/trophies_controller.rb