Ruby on Rails
ポリモーフィック関連付けとは ある一つのモデルが複数のモデルと関連付けがある事をpolymorphic: trueと1つの関連付けのみで示すことができます。モデルにポリモーフィック関連付けを行なった場合、データベースにもテーブル同士の関連付けがある事をマイグ…
has_many :through 関連付け Physician・・・・医者 Appointment・・・診察予約 Patient・・・患者 class Physician < ApplicationRecord has_many :appointments has_many :patients, through: :appointments end class Appointment < ApplicationRecord be…
ActionMailer Railsに組み込まれているメール送信機能です。 コマンドで主要ファイルを作成することが出来ます。 rails g mailer UserMailer whenever Railsで定期的に実行したいタスクを設定することが出来るGemです。 スコープとメソッドの違い 前提として…