Displaying 1 result from an estimated 1 matches for "questions_attributes".
2011 Jul 11
2
Pre-populating association
...g a ballot for that survey.
Here''s the modeling:
class Survey < ActiveRecord::Base
has_many :questions
has_many :eligibilities
has_many :ballots
accepts_nested_attributes_for :questions, :allow_destroy => true
attr_accessible :title, :description, :status, :deadline, :questions_attributes
def owner
Person.find(owner_id)
end
end
class Question < ActiveRecord::Base
belongs_to :survey
has_many :preferences
end
class Ballot < ActiveRecord::Base
belongs_to :survey
has_many :preferences
end
class Preference < ActiveRecord::Base
belongs_to :ballot
belongs...