Commit 0ae8a90fa31be7cfe33415e931ea9f1a57c063be
1 parent
c103a4fa
Exists in
master
and in
1 other branch
fix for autoactivation
Showing
2 changed files
with
7 additions
and
3 deletions
Show diff stats
app/models/choice.rb
... | ... | @@ -45,6 +45,7 @@ class Choice < ActiveRecord::Base |
45 | 45 | |
46 | 46 | #after_create :generate_prompts |
47 | 47 | def before_create |
48 | + puts "just got inside choice#before_create. is set to active? #{self.active?}" | |
48 | 49 | unless item |
49 | 50 | @item = Item.create!(:creator => creator, :data => data) |
50 | 51 | self.item = @item |
... | ... | @@ -53,7 +54,10 @@ class Choice < ActiveRecord::Base |
53 | 54 | self.score = 0.0 |
54 | 55 | end |
55 | 56 | unless self.active? |
56 | - question.should_autoactivate_ideas? ? self.active = true : self.active = false | |
57 | + puts "this choice was not specifically set to active, so we are now asking if we should auto-activate" | |
58 | + self.active = question.should_autoactivate_ideas? ? true : false | |
59 | + puts "should question autoactivate? #{question.should_autoactivate_ideas?}" | |
60 | + puts "will this choice be active? #{self.active}" | |
57 | 61 | end |
58 | 62 | return true #so active record will save |
59 | 63 | end | ... | ... |
app/models/user.rb
... | ... | @@ -19,9 +19,9 @@ class User < ActiveRecord::Base |
19 | 19 | visitor = visitors.find_or_create_by_identifier(visitor_identifier) |
20 | 20 | raise "Question not found" if question.nil? |
21 | 21 | if visitor.owns?(question) |
22 | - choice = question.choices.create!(choice_params.merge(:active => true, :creator => visitor)) | |
22 | + choice = question.choices.create!(choice_params.merge(:active => false, :creator => visitor)) | |
23 | 23 | elsif question.local_identifier == choice_params[:local_identifier] |
24 | - choice = question.choices.create!(choice_params.merge(:active => true, :creator => visitor)) | |
24 | + choice = question.choices.create!(choice_params.merge(:active => false, :creator => visitor)) | |
25 | 25 | else |
26 | 26 | choice = question.choices.create!(choice_params.merge(:active => false, :creator => visitor)) |
27 | 27 | end | ... | ... |