Class: VoteController

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

Instance Method Summary collapse

Instance Method Details

#createObject



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

def create
  # if Votable.concerned_classes.include? params[:vote_type]
    @votable_element = params[:vote_type].constantize.__send__(:find_by_id, params[:vote_id])
    @votable_element.votes.create(user_id: current_user.try(:id), direction: params[:direction])
  # else
    # redirect_to root_path
  # end
end