Sha256: 1b157849d17d6176628ccd5365b295e376cefa998e40b958b11f188c25018a0d
Contents?: true
Size: 471 Bytes
Versions: 29
Compression:
Stored size: 471 Bytes
Contents
# frozen_string_literal: true 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
29 entries across 29 versions & 1 rubygems