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

Support for Rails 4 #101

Closed jarl-dk closed 8 years ago

jarl-dk commented 11 years ago

Adding test for rails 4. Demonstrating the problem in https://github.com/adzap/validates_timeliness/issues/100

jarl-dk commented 11 years ago

I have created support for rails4.

Notice that the two last commits (81c5526 and f83b4e6) changes the tests, and these commits may not be the right thing to do. I am especially worried about the last one. It seems like default behaviour has changed, but I haven't figured out whether that is because default behaviour in Rails has changed, or because there is still things in validates_timeliness that needs to be done (for rails4).

osaris commented 11 years ago

Hope this will be reviewed/merged soon because gem is really broken with rails4 and enable_date_time_select_extension/enable_multiparameter_extension enabled.

carloslopes commented 10 years ago

:+1: Any prevision of when can this be merged?

francof commented 10 years ago

+1 , I hope this can be merged soon as well!

greyblake commented 10 years ago

+1

mhenrixon commented 10 years ago

:+1:

kapso commented 10 years ago

Any update when this will be merged for Rails 4?

kapso commented 10 years ago

Given this merge has been pending for long, is it safe to assume that this project is not being maintained actively?

Is there any way to use this in a rails 4 project or are there any alternatives for date/time validation in rails4? We have a rails 4 app that needs to go out to production very soon, so was wondering,

adzap commented 10 years ago

Sorry all. This is not abandoned at all.

kapso commented 10 years ago

@adzap Great. Any release date for the Rails 4 merge?

adzap commented 10 years ago

This has to be reviewed and merged, if all goes well then this or next week.

kapso commented 10 years ago

:thumbsup: Cheers mate, hopefully sooner than later.

adzap commented 10 years ago

Have you tried this merge yourself out of interest? More testing against real apps will be helpful.

On Feb 3, 2014, at 7:01 PM, Kapil notifications@github.com wrote:

Cheers mate, hopefully sooner than later.

— Reply to this email directly or view it on GitHub.

jarl-dk commented 10 years ago

I have tried it against my own project, and it works. However to be honest I am not done converting my project to 4.0 yet (other gems and rails bugs have prolonged the process). Please, can other provide info of real-world experience with this PR.

elomar commented 10 years ago

I've been using it in a production project for a couple months (which probably wasn't a very good idea) and didn't run into any issues. All good. I'm not doing anything fancy, though, just basic validations.

On Feb 3, 2014, at 5:53 AM, Jarl Friis notifications@github.com wrote:

I have tried it against my own project, and it works. However to be honest I am not done converting my project to 4.0 yet (other gems and rails bugs have prolonged the process). Please, can other provide info of real-world experience with this PR.

— Reply to this email directly or view it on GitHub.

osaris commented 10 years ago

+1 using this branch for month in production and no problem.

2014-02-03 Elomar Souza notifications@github.com:

I've been using it in a production project for a couple months (which probably wasn't a very good idea) and didn't run into any issues. All good. I'm not doing anything fancy, though, just basic validations.

On Feb 3, 2014, at 5:53 AM, Jarl Friis notifications@github.com wrote:

I have tried it against my own project, and it works. However to be honest I am not done converting my project to 4.0 yet (other gems and rails bugs have prolonged the process). Please, can other provide info of real-world experience with this PR.

— Reply to this email directly or view it on GitHub.

— Reply to this email directly or view it on GitHubhttps://github.com/adzap/validates_timeliness/pull/101#issuecomment-33933565 .

kapso commented 10 years ago

I just tried the rails4 branch and I am seeing this -

DEPRECATION WARNING: The `Validator#setup` instance method is deprecated and will be removed on Rails 4.2. Do your setup in the constructor instead:

class MyValidator < ActiveModel::Validator
  def initialize(options={})
    super
    options[:class].send :attr_accessor, :custom_attribute
  end
end
. (called from initialize at /Users/kapil/.rbenv/versions/2.1.0-dev/lib/ruby/gems/2.1.0/bundler/gems/validates_timeliness-00ce472d3e04/lib/validates_timeliness/validator.rb:45)

Using the following:

gem 'validates_timeliness', github: 'adzap/validates_timeliness', branch: 'rails4'
mhenrixon commented 10 years ago

The error message tells you how to fix it too, just move the code from setup to the initializer directly.

jaredbeck commented 10 years ago

The error message tells you how to fix it too, just move the code from setup to the initializer directly.

I think this fix has to happen in validates_timeliness/lib/validates_timeliness/validator.rb, no?

smooshy commented 10 years ago

I've also been running this in production for a bit and haven't had any problems yet.

emolayi commented 10 years ago

Will this be merged anytime soon? We are waiting to upgrade an application to Rails 4 that uses enable_date_time_select_extension.

svoop commented 10 years ago

Same here, works fine on Rails 4.0 in production for a while now. Please merge.

axlekb commented 10 years ago

:+1:

mszyndel commented 10 years ago

@adzap do you need help with maintaining this gem? I use it quite a lot at work so can assure interest in keeping it alive.

milgner commented 10 years ago

Thank you for the PR! This warrants a version bump and an update to the Readme, I'd say...

jarl-dk commented 10 years ago

@adzap : as an addition to https://github.com/adzap/validates_timeliness/pull/101#issuecomment-33933235, I have converted my project to Rails 4 completely and this patch is necessary and sufficient to support rails 4.

Will you merge this one? It seems that many others have tested this.

@adzap : are you looking for some support in maintaining/updating this project?

ricardodovalle commented 10 years ago

:+1: @jarl-dk

adzap commented 8 years ago

I have released v4 which hopefully gives full Rails 4.x support. It is Rails 4.x compatible only.

Thanks for your patience.