Displaying 1 result from an estimated 1 matches for "find_all_questions".
2008 Sep 19
0
validates_uniqueness_of: passing a method to :scope
...belongs_to :survey
validates_uniqueness_of :survey_position, :scope => :survey_id
end
This creates problems for when saves cascade down associated objects.
Any ideas on how to pass a method name as the scope option? Then I could
add (instead of the above):
class Survey
def questions
find_all_questions.sort_by(:survey_position)
end
end
class Question
validates_uniqueness_of :survey_position, :scope =>
:survey_id_from_area
def survey_id_from_area
area.survey.id
end
end
Any ideas?
~ Mark
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~-...