Closed jasl closed 6 years ago
Ah yes thanks for this. You can see I had attempted a module override to preserve super
but forgot to change after using class_eval
.
I think I will review to see if I can it get working with the module to avoid aliasing methods. If not I will use your PR.
I think just alias the origin one is enough, or you may need to using prepend
Yes we can alias but I'd like to avoid that. I have removed as many aliases as I can from the plugin.
I think the module will work in Date but it didn't work in Time and DateTime due to some funky delegation AR uses to inject timezone aware casting.
Or maybe you can create a subclass of Type::Date
, Type::Datetime
, and overrides ActiveModel::Type
lookup table, see https://github.com/rails/rails/blob/master/activemodel/lib/active_model/type.rb#L44
But that's a bad design of Rails, AR reimplement this, so you also need to overrides here https://github.com/rails/rails/blob/master/activerecord/lib/active_record/type.rb#L69
In addition,
sqlite3-ruby
is no use now, so I remove it.