On Tue, Jun 9, 2009 at 23:29, Gee-off <[email protected]> wrote: > > I a have a problem with a time- > only field in MySQL returning as nil unless it is exactly > "00:00:00" (HH:MM:SS) as stored in a 'time' datatype.
Maybe there's a bug in activerecord that translates "00:00:00" time to ruby nil value? > I've played around with various date/time formatting actions in the > controller, view, and model but I get a variation of the > the following error: If there's a bug, it's in activerecord, so extra code in controllers and view will not help. The best tool to start investigating this is invoke your script/console and play with your models from there. Like this: >> record.mytime = time >> record.save >> record.reload >> record.mytime > I'm using Netbeans 6.7 beta It doesn't matter what text editor or IDE are you using :) Ruby ver. 1.8.6 and AR ver. 2.1.0 First thing that you should always do when you think you find a bug is to try doing the same thing with the newest version of ActiveRecord. If the buggy behavior is still present in that version, try freezing the latest 2-3-stable git branch in your application (it contains bugfixes made after the last 2.3.x stable version). If the bug is still present, search for it in the issue tracker: https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets?q=mysql+time+nil If you cannot find anything similar (either among open issues or resolved ones) then you have to report it. You can create a new ticket and describe your problem, but the best way is to prove the bug with some code — we call this a failing test case. To do this you have to clone the rails repository from git (if you don't have it already) and study existing activerecord tests dealing with mysql-to-ruby type conversion. You can start by searching the "activerecord/test/" directory for "bonus_time", because that is the only time column in the test schema. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
