Created
June 4, 2012 18:47
-
-
Save hannesfostie/2870139 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 Doctor < ActiveRecord::Base | |
attr_accessible :name, :phone, :province_id | |
has_many :schedules, :dependent => :destroy | |
has_one :province | |
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 Province < ActiveRecord::Base | |
attr_accessible :name | |
has_many :schedules | |
has_many :doctors | |
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 Schedule < ActiveRecord::Base | |
attr_accessible :doctor_id, :date, :province_id | |
belongs_to :doctor | |
belongs_to :province | |
validates_uniqueness_of :province_id, :scope => :date | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment