search for: survey_position

Displaying 1 result from an estimated 1 matches for "survey_position".

2008 Sep 19
0
validates_uniqueness_of: passing a method to :scope
...:survey has_many :questions, :order => ''position'' validates_uniqueness_of :position, :scope => : survey_id end 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'&...