Sha256: 09010c29927ef2883a2026fcb7cb681a2f6659742fb83d3501df59d49b068d43
Contents?: true
Size: 434 Bytes
Versions: 6
Compression:
Stored size: 434 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 return false if t.persisted? else t = current_user.trophies.create(work_id: work_id) return false unless t.persisted? end render json: t end end end
Version data entries
6 entries across 6 versions & 1 rubygems