Created
April 12, 2019 13:14
-
-
Save salami-art/95f208eb602629cc3b2112f940ed3ebd to your computer and use it in GitHub Desktop.
This file contains hidden or 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 Rating::Option < ApplicationRecord | |
belongs_to :rating_type, class_name: 'Rating::Type', :foreign_key => "rating_type_id" | |
has_many :rating_scores, class_name: 'Rating::Score', :foreign_key => "rating_option_id", dependent: :destroy | |
end |
This file contains hidden or 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 Rating::Score < ApplicationRecord | |
belongs_to :rating_type, class_name: 'Rating::Type', :foreign_key => "rating_type_id" | |
belongs_to :rating_option, class_name: 'Rating::Option', :foreign_key => "rating_option_id" | |
end |
This file contains hidden or 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 Rating::Type < ApplicationRecord | |
has_many :rating_options, class_name: 'Rating::Option', :foreign_key => "rating_type_id", dependent: :destroy | |
has_many :rating_scores, class_name: 'Rating::Score', :foreign_key => "rating_type_id", dependent: :destroy | |
accepts_nested_attributes_for :rating_options, allow_destroy: true | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment