Sha256: 455f61ffacdbd7911eb31ebf69bdf0e75afccc9ddcdd66a7e3641c4787ea5e2f
Contents?: true
Size: 441 Bytes
Versions: 57
Compression:
Stored size: 441 Bytes
Contents
module Hyrax class TrophiesController < ApplicationController before_action :authenticate_user! def toggle_trophy work_id = params[:id] t = current_user.trophies.where(work_id: work_id).first if t authorize!(:destroy, t) t.destroy else t = current_user.trophies.build(work_id: work_id) authorize!(:create, t) t.save! end render json: t end end end
Version data entries
57 entries across 57 versions & 1 rubygems