3
私はレール関連のチュートリアル、私は私のニーズに合わせて、さらにこのモデルを拡張したい
http://guides.rubyonrails.org/association_basics.html
を通じてつもりです
:私はモデルを作る必要がありますどのように
class Physician < ActiveRecord::Base
has_many :appointments
has_many :patients, :through => :appointments
end
class Appointment < ActiveRecord::Base
belongs_to :physician
belongs_to :patient
end
class Patient < ActiveRecord::Base
has_many :appointments
has_many :physicians, :through => :appointments
end
をhas_many
予定協会
class Physician < ActiveRecord::Base
has_many :appointments
has_many :availableappointments
has_many :patients, :through => :appointments
end
class Availableappointment < ActiveRecord::Base
belongs_to :physician
end
0:たとえば
Physician
と
モデルに異なる時間枠を保存する方法がわかりません。医師は午前8時から午後3時まで利用可能で、各予約は30分(8:30-9,9-9,30,9:30-10)です...この情報をDBまたはAvailableappointment
モデルに保存するにはどうすればいいですか?