Time fields not working
Reported by Ashley Moran | September 8th, 2008 @ 07:27 PM
Hobo seems to have an issue with :time fields.
To recreate the issue:
% rails time_test
Add HoboFields to config/environment.rb:
config.gem 'hobosupport', :version => '>= 0.8.1'
config.gem 'hobofields', :version => '~> 0.8.1'
% script/generate hobo_model TestModel test_time:time
Migrate from within the Hobo migration command:
% script/generate hobo_migration
% script/console
TestModel.create!(:test_time => "12:00:00")
Fails with:
ArgumentError: wrong number of arguments (1 for 0)
from /opt/local/lib/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/attribute_methods.rb:211:in initialize'
from /opt/local/lib/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/attribute_methods.rb:211:in
new'
...
To fix:
Change lib/hobo_fields.rb PLAIN_TYPES to read:
PLAIN_TYPES = {
:boolean => Hobo::Boolean,
:date => Date,
:datetime => (defined?(ActiveSupport::TimeWithZone) ? ActiveSupport::TimeWithZone : Time),
# ADDED:
:time => (defined?(ActiveSupport::TimeWithZone) ? ActiveSupport::TimeWithZone : Time),
:integer => Fixnum,
:big_integer => BigDecimal,
:decimal => BigDecimal,
:float => Float,
:string => String
}
Don't actually know why that fixes it, hopefully you have more insight!!!
Comments and changes to this ticket
-
Tom Locke September 11th, 2008 @ 10:15 AM
- State changed from new to open
-
Tom Locke November 3rd, 2008 @ 03:15 PM
- State changed from open to resolved
Thanks for reporting this - fixed now.
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป