lib/census/user.rb in census-0.4.0 vs lib/census/user.rb in census-0.4.1
- old
+ new
@@ -65,9 +65,17 @@
# question, or a new empty answer if the user did not select the given choice.
#
def answer_for_choice(choice)
answers.select {|a| a.question == choice.question && a.data == choice.value}.first || answers.build(:question => choice.question, :data => '')
end
+
+ #
+ # Returns a Census::UserData object that can be used to retrieve this user's
+ # answers.
+ #
+ def census_data
+ @census_data ||= Census::UserData.new(self)
+ end
private
#
# After save callback, used to remove blank answers