給一兩個型號,一個has_one協會: class ShopInfo
belongs_to :shop
end
class Shop
has_one :shop_info
end
s = Shop.create
ss1 = s.create_shop_info
在其他一些地方我的代碼做 ss2 = s.create_shop_info
在此之後,SS1。
雖然我已經獲取了不允許的屬性錯誤,但我允許在考試控制器中使用這些屬性。 嵌套的第一級工作正常。第二個層次,答案不救,服務器說「不允許的參數:回答」 給予將高度appriciated 模型exam.rb任何幫助 class Exam < ActiveRecord::Base
mount_uploader :attachment, PdfUploader #mount the pdf up
是否有可能/正確的表間關係只能走一條路?我有一個invoices表,我需要在其他表中參考,如commission_payments和membership_payments,但invoices表不需要commission_payment_id或membership_payment_id。換句話說,可能發生不同類型的交易,並且他們都可能附有發票,但發票不需要引用這些交易表。 invoices co