GithubHelp home page GithubHelp logo

Comments (5)

adzap avatar adzap commented on August 16, 2024

Hi,

This is a side effect of a unfortunate design decision on my part for version 2, which is to override the date/time parsing of all such columns regardless of validation done on them. It was initially to give the most correct time and date parsing available. But it is unexpected consequence of this version of the plugin. I changed this in version 3.

This issue here is being caused by the assignment of an integer to a date/time attribute. The plugin assumes all these columns are being used as time or date values and not to store a duration.

Is this a duration you are storing?
What is the database type?

from validates_timeliness.

dlupu avatar dlupu commented on August 16, 2024

Hi,

Thanks for answering so quickly. Indeed i'm storing a duration. I use mysql.

Since I can't migrate on Rails 3 yet, is there a workaround?

Thakns!

from validates_timeliness.

adzap avatar adzap commented on August 16, 2024

Not easily at the moment. Perhaps try assigning Time.at(1.second) for seconds since epoch. But I have never used a duration column before, so i don't know it's correct usage.

Otherwise I will have to add an attribute exclusion list to v2.3.

from validates_timeliness.

dlupu avatar dlupu commented on August 16, 2024

Hello

Sorry for answering only now. I tested your suggestion but it didn't work.

However current_wt.online = "00:00:01" seems to do the trick :)

from validates_timeliness.

adzap avatar adzap commented on August 16, 2024

I was under the impression there was a mysql database type of duration. It seems there is not so I will close this ticket as the plugin won't support fixnum assignments.

If the plugin is overriding the write accessor it means the column you are using is a date/time data type. Perhaps using this data type for a duration column is not a wise choice.

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.