validates_timeliness icon indicating copy to clipboard operation
validates_timeliness copied to clipboard

Gem in 5.0.0 version not execute "timeliness" validations in ActiveRecord models

Open pedrofurtado opened this issue 3 years ago • 12 comments

Hi @adzap ! 👋

We was using Rails 6.1.3.1 with validates_timeliness in version 4.1.1. Everything worked well 🍻

After upgrade the gem to 5.0.0, the timeliness-specific validations is not executed.

# With Rails 6.1.3.1 + validates_timeliness 4.1.1 = works well
class Person < ApplicationRecord
  validates :birthday, presence: true, timeliness: { on_or_before: :today, type: :date }
end
# With Rails 6.1.3.1 + validates_timeliness 5.0.0 = timeliness-specific validation not triggered
class Person < ApplicationRecord
  validates :birthday, presence: true, timeliness: { on_or_before: :today, type: :date }
end

pedrofurtado avatar Apr 03 '21 13:04 pedrofurtado

c/c: @willradi @leonardocomar

pedrofurtado avatar Apr 03 '21 14:04 pedrofurtado

@pedrofurtado are you able to share you ValidatesTimeliness initializer?

Also, the version should match the major Rails version you are using. v5 is meant for Rails v5.x compat. The v6 alpha went out yesterday and is going to the version were any Rails v6.x issues are addressed.

adzap avatar Apr 05 '21 04:04 adzap

My initializer has this code:

# config/initializers/validates_timeliness.rb

ValidatesTimeliness.setup do |config|
  config.extend_orms = [:active_record]
end

pedrofurtado avatar Apr 05 '21 11:04 pedrofurtado

Can you add in this line and see if it makes any difference

config.parser.use_us_formats

adzap avatar Apr 05 '21 22:04 adzap

@adzap I think it's better to wait a official release of 6.x version of gem. We upgraded, for testing, the gem to 6.0.0.alpha1 and everything worked well 🎉

Is there some planning to release a official 6.x version soon, @adzap ? 🤝 🍻

pedrofurtado avatar Apr 06 '21 01:04 pedrofurtado

I imagine beta version would soon. Final depends on any issues and confirmed usage. I have no Rails 6 projects yet so I won't be using that version at the moment.

adzap avatar Apr 06 '21 03:04 adzap

@adzap We have tried 6.x alpha version here in our Rails6 app and it's working well. Is there any planning to release the official 6.x version soon? 🎉 🍻

pedrofurtado avatar Apr 20 '21 22:04 pedrofurtado

@pedrofurtado yep soon. once I have some feedback from others.

adzap avatar Apr 22 '21 03:04 adzap

Hello guys! I have a Rails 6 app with 6.x-alpha version and it's working too. Just waiting for the release.. o/

WillRadi avatar Apr 22 '21 11:04 WillRadi

Hi! In my application Rails 6 wiith 6.x-alpha version, it's working very well 👍

LeonardoComar avatar Apr 23 '21 11:04 LeonardoComar

@adzap We are using gem in 6.0.0.alpha1 for several weeks, in three different Rails apps in production, and I confirm that it is stable enough 👍 Happy to see a official release of 6.x, to upgrade in our Rails app here 🤝 🍻

pedrofurtado avatar May 16 '21 14:05 pedrofurtado

Any news about it? 🤝 🍻

pedrofurtado avatar Jun 15 '21 14:06 pedrofurtado