#850 suggestion
Paul Sadauskas (Rando)

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

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.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Referenced by