我有兩個型號命名的用戶和後 User.rb class User < ApplicationRecord
has_many :posts
end
Post.rb 發佈的訊息 class Post < ApplicationRecord
belongs_to :user
end
截至目前,用戶可以創建,更新,刪除特定的帖子。 我試圖深入學習Active Record,
的情況我有兩個表,車和項目 class Carts
has_many :items
end
class Items
belongs_to :carts
end
table Item
:status string ('auto_assigned', 'deleted', 'added')
:quantity integer
:cart_id integer
table C