
Can't make String properties with arbitrary length
Reported by Paul Sadauskas (Rando) | May 14th, 2009 @ 04:51 PM
Setting a property with type String
forces a limit
on the length. It defaults to 50, and there is no way to un-set
it.
property :name, String, :length => nil
# +options[:length]+ should be Range or Integer, but was NilClass (ArgumentError)
property :name, String, :length => n
# options[:length]+ should be Range or Integer, but was Float (ArgumentError)
Yes, I could used Text, :lazy => false
, but
thats convoluted. Postgres has no limit on the length of VARCHAR
columns, and MySQL has a 64K limit, but requires that a limit be
specified. SQLite3 has no limit, even if one is specified. Several
other adapters have no limit on a string-ish attribute.
My suggestion would be to remove the default 50-char limit from String properties, and have no default limit. The MySQL adapter can then pick a special default, since it is the only one that needs it.
Comments and changes to this ticket
-
Paul Sadauskas (Rando) May 23rd, 2009 @ 12:55 AM
- Assigned user set to Paul Sadauskas (Rando)
-
Dan Kubb (dkubb) October 6th, 2009 @ 01:09 PM
- Tag changed from adapters, property, types to adapters, property, suggestion, types
- State changed from unconfirmed to suggestion
- Assigned user cleared.
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 »
People watching this ticket
Tags
Referenced by
-
867 URI type defaults to VARCHAR(50), isn't that too conservative? Duplicate of #850