Created
June 15, 2016 13:43
-
-
Save jeroenvisser101/a7cf75ea3112add1ab0839e07eefde85 to your computer and use it in GitHub Desktop.
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 Campaign | |
field :name | |
# ... | |
has_many :shortcodes_services | |
has_many :phone_numbers, through: :campaigns_phone_number | |
end | |
class CampaignsPhoneNumber | |
belongs_to :campaign | |
belongs_to :phone_number | |
end | |
class PhoneNumber | |
field :name | |
field :phone_number | |
# ... | |
has_many :shortcodes_services | |
has_many :campaigns, through: :campaigns_phone_number | |
end | |
3.times { phone_numbers << PhoneNumber.create(name: 'hello world', phone_number: '1234') } | |
campaign = Campaign.create(name: 'hello world', phone_numbers: phone_numbers) | |
# In a later stage | |
campaign.update(phone_numbers: phone_numbers.last) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment