Last active
August 29, 2015 14:23
-
-
Save tienshunlo/2d424c2a95fd9a0904de to your computer and use it in GitHub Desktop.
surveysays
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Answer < ActiveRecord::Base | |
belongs_to :question | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Question < ActiveRecord::Base | |
belongs_to :survey | |
has_many :answers, :dependent => :destroy | |
accepts_nested_attributes_for :answers, :reject_if => lambda { |a| a[:content].blank? }, :allow_destroy => true | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Questionnaire < ActiveRecord::Base | |
has_many :questions, :dependent => :destroy | |
accepts_nested_attributes_for :questions, :reject_if => lambda { |a| a[:content].blank? }, :allow_destroy => true | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Survey < ActiveRecord::Base | |
has_many :questions, :dependent => :destroy | |
accepts_nested_attributes_for :questions, :reject_if => lambda { |a| a[:content].blank? }, :allow_destroy => true | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment