Class: VotesController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- VotesController
- Defined in:
- app/controllers/votes_controller.rb
Overview
Handling votes
Instance Method Summary collapse
-
#create ⇒ Object
post /votes.
-
#destroy ⇒ Object
delete /votes/:id.
Instance Method Details
#create ⇒ Object
post /votes
8 9 10 11 12 13 14 15 |
# File 'app/controllers/votes_controller.rb', line 8 def create @entity = Vote.new(creation_parameters) if @entity.votable.vote_applicable?(@entity) process_vote else render :result, status: :unprocessable_entity end end |
#destroy ⇒ Object
delete /votes/:id
18 19 20 21 |
# File 'app/controllers/votes_controller.rb', line 18 def destroy @entity.destroy render :result end |