Class: VotesController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/votes_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject

post /votes



5
6
7
8
9
10
11
12
# File 'app/controllers/votes_controller.rb', line 5

def create
  @entity = Vote.new(creation_parameters)
  if @entity.votable.vote_applicable?(@entity)
    process_vote
  else
    render :result, status: :unprocessable_entity
  end
end

#destroyObject

delete /votes/:id



15
16
17
18
# File 'app/controllers/votes_controller.rb', line 15

def destroy
  @entity.destroy
  render :result
end