I usually include ActiveModel::Model into some PORO (for example for a FormObject::SignUp). I've read about the new Rails 5 ActiveRecord::Attribute API, and I thought I will be able to use it for simpler casting, but not luck.
For example, given
class FormObject::SignUp
include ActiveRecord::Model
include ActiveRecord::Attributes
attribute :birthday, :date
validates :birthday, presence: true
end
I got an NameError: undefined local variable or method `reload_schema_from_cache' for FormObjects::SignUp:Class
exception when I try to instantiate it.
It is not expected to be used standalone? Thanks