RAILS3:: 有安裝新套件,rails server要重新啟動
RAILS3:: ActionMailer 的樣版跟 method同名.
RAILS3:: join table因為有兩個foregin key, 所以它需有兩個belongs_to 分別屬於另外兩個資料庫
RAILS3:: 在多對多的資料庫結構下,必需增加一個新的join table用來關聯兩個資料庫, 該join table包含兩個資料庫的foregin key ,用來關聯兩個資料庫 (因此belongs_to要放在新建的join table)
RAILS3:: has_one 後面接 model的單數, has_many後面接 model的複數
RAILS3 :: ActivateRecord 中有foreign key的model就是設定blelongs_to的model
RAILS3:: 資料建立方法使用 build 後要使用save , 使用create則不需使用save
RAILS3::在查詢時不要直接使用字串,以免產生sql injection問題