Last active
December 1, 2017 02:14
-
-
Save ornerymoose/abb43dad682535d8a1a558475896abbf to your computer and use it in GitHub Desktop.
I need the association model (relationship.rb) to be separate from child and outage, bc child and outage will connect to two separate remote SQL Server databases that will just read data. Where the relationship model will make the association: child belongs_to outage, outage has_many children
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 Child < ApplicationRecord | |
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 Outage < ApplicationRecord | |
has_many :relationships | |
has_many :children, through: :relationships | |
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 Relationship < ApplicationRecord | |
belongs_to :outage, optional: true | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment