Hobofields attr_accessor type broken for plain types
Reported by Iain | November 17th, 2009 @ 09:56 PM
I've just been playing around with the :type argument that hobo fields adds to virtual field declarations. This is the example given in the hobofields tutorial:
>>class Advert
attr_accessor :my_attr, :type => :text
end
>> a = Advert.new
>> a.my_attr = "hello"
>> a.my_attr.class
=> HoboFields::Text
This is great, however, it seems to be broken for plain types (ie. any type that isn't one defined in hobo fields). When (in my hobo app) I define an attribute as:
attr_accessor :my_attr, :type => :integer
I get the following error: "uninitialized constant Integer::COLUMN_TYPE" on /Library/Ruby/Gems/1.8/gems/hobofields-0.8.10/lib/hobo_fields.rb:66:in `can_wrap?'. It seems that the column types aren't being defined (or populated) for non-hobofields types.
In the class definitions for hobofields types there is always a COLUMN_TYPE constant defined, but for old types I think it either needs to be set in the classes themselves or hobofields needs to look for the COLUMN_TYPE in it's own code somewhere.
Comments and changes to this ticket
-
Bryan Larsen November 17th, 2009 @ 11:04 PM
I get:
>> class Advert attr_accessor :my_attr, :type => :integer end >> a = Advert.new >> a.my_attr = 17 >> a.my_attr.class => Fixnum
Which seems to be correct to me. Can you elaborate further? Thanks.
-
Bryan Larsen November 18th, 2009 @ 01:45 PM
- State changed from new to duplicate
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 »