I keep getting hoptoad notifications for
"ActiveRecord::StatementInvalid: PGError: ERROR: value too long for
type character varying(2)"

Somehow users occasionally attempt to enter a full State name into a
field that is limited to 2 characters.  I can't reproduce the error,
whether entering the State data manually (gets cut off at two
characters, doesn't allow more than two to be typed into the form), or
with a browser's autofill feature (State also gets cut off at two
characters).

The field in the view file is limited to 2 characters:

<%= form.text_field :billing_state, :maxlength =>
@order.column_for_attribute('billing_state').limit, :size => 2 %>

The field in the Postgresql database on Heroku is limited to 2
characters:

#<ActiveRecord::ConnectionAdapters::PostgreSQLColumn:0x2b50c87b2f98
@type=:string, @scale=nil, @sql_type="character varying(2)",
@precision=nil, @primary=nil, @default=nil, @limit=2, @null=true,
@name="billing_state">

I can't figure out how a user can enter more characters than are
allowed, which makes it impossible for me to fix this bug.

Has anybody else ran into this situation?

TIA for any help.

-- 
You received this message because you are subscribed to the Google Groups 
"Heroku" 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/heroku?hl=en.

Reply via email to