Last active
December 28, 2015 22:09
-
-
Save lilithlavender/7569216 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 Franchisee < ActiveRecord::Base | |
| belongs_to :user | |
| has_many :phone_numbers, as: :phoneable, dependent: :destroy | |
| accepts_nested_attributes_for :phone_numbers, allow_destroy: true | |
| validates :region_code, presence: true | |
| 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 PhoneNumber < ActiveRecord::Base | |
| belongs_to :phoneable, :polymorphic => true | |
| validates :phone_number, presence: true | |
| 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 User < ActiveRecord::Base | |
| has_one :franchisee, dependent: :destroy | |
| accepts_nested_attributes_for :franchisee | |
| validates :first_name, presence: true | |
| validates :last_name, presence: true | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment