Class: VotesController

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

Instance Method Summary collapse

Instance Method Details

#createObject



2
3
4
5
6
7
8
9
10
11
12
13
14
# File 'app/controllers/votes_controller.rb', line 2

def create
  @vote = Vote.new(params[:vote])
  set_polymorphic_vars(@vote)
  add_fingerprint_and_user_id(@vote)
  create! do |success, failure|
    success.html do
      add_able_rep("upvote",@vote) if @vote.up?
      add_able_rep("downvote",@vote) if @vote.down?
      redirect_to :back
    end
    failure.html { redirect_to :back }
  end
end