From 0ae8a90fa31be7cfe33415e931ea9f1a57c063be Mon Sep 17 00:00:00 2001 From: Pius Uzamere Date: Fri, 15 Jan 2010 14:43:46 -0500 Subject: [PATCH] fix for autoactivation --- app/models/choice.rb | 6 +++++- app/models/user.rb | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/models/choice.rb b/app/models/choice.rb index ef43d6a..06b1fd2 100644 --- a/app/models/choice.rb +++ b/app/models/choice.rb @@ -45,6 +45,7 @@ class Choice < ActiveRecord::Base #after_create :generate_prompts def before_create + puts "just got inside choice#before_create. is set to active? #{self.active?}" unless item @item = Item.create!(:creator => creator, :data => data) self.item = @item @@ -53,7 +54,10 @@ class Choice < ActiveRecord::Base self.score = 0.0 end unless self.active? - question.should_autoactivate_ideas? ? self.active = true : self.active = false + puts "this choice was not specifically set to active, so we are now asking if we should auto-activate" + self.active = question.should_autoactivate_ideas? ? true : false + puts "should question autoactivate? #{question.should_autoactivate_ideas?}" + puts "will this choice be active? #{self.active}" end return true #so active record will save end diff --git a/app/models/user.rb b/app/models/user.rb index 71c84da..0c955d5 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -19,9 +19,9 @@ class User < ActiveRecord::Base visitor = visitors.find_or_create_by_identifier(visitor_identifier) raise "Question not found" if question.nil? if visitor.owns?(question) - choice = question.choices.create!(choice_params.merge(:active => true, :creator => visitor)) + choice = question.choices.create!(choice_params.merge(:active => false, :creator => visitor)) elsif question.local_identifier == choice_params[:local_identifier] - choice = question.choices.create!(choice_params.merge(:active => true, :creator => visitor)) + choice = question.choices.create!(choice_params.merge(:active => false, :creator => visitor)) else choice = question.choices.create!(choice_params.merge(:active => false, :creator => visitor)) end -- libgit2 0.21.2