Displaying 1 result from an estimated 1 matches for "validates_uniquess_of".
Did you mean:
validates_uniquness_of
2008 Sep 19
0
validates_uniqueness_of: passing a method to :scope
...class Question
belongs_to :area
validates_uniqueness_of :position, :scope => : area_id
end
So to get the questions on a survey, sorted by the ''survey_position''
attribute I have to add a foreign key to the question, so that I can
pass the survey_id to the :scope argument on validates_uniquess_of. So,
I have to add this stuff to Survey and Question classes:
class Survey
has_many :questions, :order => ''questions.survey_position''
end
class Question
belongs_to :survey
validates_uniqueness_of :survey_position, :scope => :survey_id
end
This creates problems for w...