Class: Sufia::TrophiesController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Sufia::TrophiesController
- Defined in:
- app/controllers/sufia/trophies_controller.rb
Instance Method Summary collapse
Instance Method Details
#toggle_trophy ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 |
# File 'app/controllers/sufia/trophies_controller.rb', line 3 def toggle_trophy work_id = params[:id] :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 |