GithubHelp home page GithubHelp logo

Comments (7)

Grammarella avatar Grammarella commented on July 17, 2024

I should mention that for me, ValidatesTimeliness.enable_datetime_select_extension! doesn't just add something nice (the idea of displaying the bad date). If I do not have that line, the gem does not work for me at all. What I mean is that without that line, a bad date passes by as it does in normal Rails, with November 31st becoming December 1st, and no error is raised.

from validates_timeliness.

dzajic avatar dzajic commented on July 17, 2024

+1 in Rails 3

from validates_timeliness.

gjb83 avatar gjb83 commented on July 17, 2024

+1 in Rails 3.0.5

from validates_timeliness.

brendon avatar brendon commented on July 17, 2024

+1 for Rails 3.

from validates_timeliness.

miskander avatar miskander commented on July 17, 2024

I created a fork with a patch for v2.3. Unfortunately I do not have an install of Rails 3 to fix the latest release, but I will try to look at it. If you have Rails 2.3.5 you can look here for the fix: https://github.com/miskander/validates_timeliness. It was submitted to ruby gems, see http://rubygems.org/gems/markos_validates_timeliness.

from validates_timeliness.

adzap avatar adzap commented on July 17, 2024

Is this resolved in Rails 3?

from validates_timeliness.

Grammarella avatar Grammarella commented on July 17, 2024

I believe it is mostly resolved in Rails 3. I have just been able to migrate to Rails 3.2.8, and now the bad date is usually shown in the date_select when there are errors.

I say "mostly," and "usually," because there is one case where it does not work. If the bad date is within a nested object, and the date_select is therefore within a nested form, then the entire date gets wiped out. I believe this happens before returning to the view. Basically, the validation from validates_timeliness runs fine, and correctly adds the error for a bad date. This validation is in the model of the nested object. In that same model, a separate validation to see that the date is not blank will also fire, making me think that the validation for the bad date may have wiped it out. Then, of course, the page shows no date when it reloads.

If the date is good, then it is still shown in the date_select. Only bad dates are cleared out.

I do have config.enable_date_time_select_extension! on in the gem's initializer. I am using validates_timeliness version 3.0.14. Any ideas?

from validates_timeliness.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.