makandra/active_type

Since 0.6.3 version it changes the way to Casting records or relations

Closed this issue · 2 comments

In the Readme say than the way to do "Casting records or relations" is using: ActiveType.cast

But in 0.6.3 version rise the next error:

undefined method `Util' for ActiveType:Module

I think the documentation sample should be change to:

class User < ActiveRecord::Base
  ...
end

class SignUp < ActiveType::Record[User]
  ...
end

user = User.find(1)
sign_up = ActiveType::Util.cast(user, SignUp)
sign_up.is_a?(SignUp) # => true

The public API should remain ActiveType.cast(obj, type).

Fixed in 0.6.4, should work as ActiveType.cast again. Thanks for reporting!