class UserModel
include Virtus.model
attribute(:first, String, default:Faker::Name.first_name )
attribute(:last, String, default: Faker::Name.last_name )
attribute(:email, String, default:lambda{|user, attribute| "#{user.first}.#{user.last}@devmail.company.com"} )
end
class OwnerModel
include UserModel
attribute(:email, String, default:lambda{|owner, attribute| "#{owner.first}.#{owner.last}@owner.company.com" })
attribute(:address, String, default:'5210 Paseo de Pablo' )
end
However, when I do that I get an error saying: wrong argument type Class (expected Module) (TypeError). I believe this is because Virtus wants me to combine things as Modules. However, if I change both of these above to Modules and then include them in my own class, I no longer get methods like attributes on my own class.
Is there a supported way to do this kind of composing?
I want to do something like this:
However, when I do that I get an error saying:
wrong argument type Class (expected Module) (TypeError)
. I believe this is because Virtus wants me to combine things as Modules. However, if I change both of these above to Modules and then include them in my own class, I no longer get methods likeattributes
on my own class.Is there a supported way to do this kind of composing?