makandra / active_type

Make any Ruby object quack like ActiveRecord
MIT License
1.09k stars 74 forks source link

make ActiveType::Object work without db connection #86

Closed kratob closed 7 years ago

kratob commented 7 years ago

I've tried to change the type casting logic to not require a database connection. This is probably a breaking change for Rails 4 and 5, since it means no support for database-specific types, but I never actually used this. I don't feel this has been a useful (or in the case of ActiveType::Object expected) feature, so I think this should be worth it? @triskweline: Do you have a opinion on this?

triskweline commented 7 years ago

What would be some useful examples for database-specific types we could no longer support with this change? I guess there are some useful ones like array fields or json fields?

kratob commented 7 years ago

In theory, but I'm not sure array or json types would lead to any useful behavior when it comes to coercion. I'll try to see if I can come up with a useful example.

Another thing that could be possible (but I'm not sure either), is that the old behavior allowed for some aliases (like :varchar for :string)

kratob commented 7 years ago

I've taken a look and cannot find an example where it would make a difference. The specialized database types (like :json, :polygon, :macaddr) define custom serialization logic (which we don't use), but no casting logic.