我有一个这样的模型:
class ForgotPasswordForm
include ActiveModel::Model
include ActiveModel::Validations
attr_accessor :email
validates_presence_of :email
end我想创建一个模块,并且我想测试使用该模块的模型是否具有某个属性。
然后,我将把这个模块包含到上面的ForgotPasswordForm中。
我该怎么做呢?
发布于 2017-04-12 04:21:41
使用这个:ForgotPasswordForm.attribute_names
https://stackoverflow.com/questions/43355286
复制相似问题