Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
任何人都知道如何使用includemixin 与类继承( class Car < ActiveRecord::Base)来定义活动记录模型。
include
class Car < ActiveRecord::Base
我在任何地方都找不到语法,但我知道它是在 Rails 3.1/3.2 中引入的
你指的是这样的事情吗?
class Car include ActiveModel::Model end
虽然这不会给你持久性。你到底想做什么?