Commit d5f35d812473ff11a4923814ca190e6a72c9bd12

Authored by Luke Baker
1 parent 3c6464b4

update vote create options to include objects

instead of ids, include the actual objects that we already have on hand.
this prevents a lookup in the database
Showing 1 changed file with 1 additions and 1 deletions   Show diff stats
app/models/visitor.rb
... ... @@ -48,7 +48,7 @@ class Visitor < ActiveRecord::Base
48 48 other_choices = prompt.choices - [choice]
49 49 loser_choice = other_choices.first
50 50  
51   - options.merge!(:question_id => prompt.question_id, :prompt_id => prompt.id, :voter_id=> self.id, :choice_id => choice.id, :loser_choice_id => loser_choice.id)
  51 + options.merge!(:question_id => prompt.question_id, :prompt => prompt, :voter => self, :choice => choice, :loser_choice => loser_choice)
52 52  
53 53 v = votes.create!(options)
54 54 safely_associate_appearance(v, @appearance) if associate_appearance
... ...