adzap / validates_timeliness

Date and time validation plugin for ActiveModel and Rails. Supports multiple ORMs and allows custom date/time formats.
MIT License
1.59k stars 227 forks source link

Update due deprecation for rails 7.0 #215

Closed camilova closed 2 years ago

Laykou commented 2 years ago

@adzap Can this be merged and released as new version please?

nataliastanko commented 2 years ago

.gemspec has activemodel locked to versions < 7 so your suggested change wouldn't work.

The new suggested change:

$rails c
Eager loading is enabled. New files might not have any effect until the app is restarted.
Running via Spring preloader in process 11917
Loading development environment (Rails 6.1.4.4)
irb(main):001:0> ActiveRecord.default_timezone
(irb):1:in `<main>': undefined method `default_timezone' for ActiveRecord:Module (NoMethodError)
irb(main):002:0> 

does not work with Rails 6.

I suggest changing the activemodel dependency to the following: s.add_runtime_dependency("activemodel", [">= 7", "< 8"])

camilova commented 2 years ago

Hi @nataliastanko, changing runtime dependency will not solve this, but it is needed too. I simply made a ternary to switch method to call and make it retrocompatible.

berkos commented 2 years ago

👋 Thanks for the work into this. 🙏 I was wondering if this PR is needed? I can see there is already an open PR addressing Rails 7 which would be great if it can be merged.

camilova commented 2 years ago

As commented by @berkos this PR is not needed in favor of #213 I close this.