class User < ActiveRecord::Base
end
class Users::ChangePassword < ActiveType::Record[User]
attribute :old_password, :string
validates :old_password, presence: true
end
u = User.find 1
form = ActiveType.cast u, Users::ChangePassword
form.update old_password: ''
will get "undefind method old_password", because form.errors's instance var @base is still u
will get "undefind method old_password", because
form.errors
's instance var@base
is stillu
I've fixed it in https://github.com/snow/active_type/commit/cafe7ed1bd4b73b6922d1000a8b2647e81585284 But when I ran the specs, find out it requires PgSQL. It's 03:47+0800 now, I'm so tired and all I want is Vodka and sleep, so I will setup PgSQL, run the spec and create a PR some days later. Maybe in this weekend.