Polite Strings

Do you have ActiveRecord classes that contain strings?

Do you sometimes put strings into those classes that are too wide for
the database column?

Is it really suboptimal when you get a SQL error when you .save the
object?

Are there string columns that you’d like to convert to lower case
before they’re stored in the database?

What you need is Polite Strings.
http://dppruby.com/dppsrubyplayground/show/Polite+Strings

Polite Strings is a module that you can add to your ActiveRecord
classes. Polite Strings will make sure strings don’t overflow the
column widths in the database (you can disable this function on a
field-by-field basis). Polite Strings will optionally convert a
column to lower case. Polite Strings will optionally convert bytes in
your strings that have the high bit set to spaces (thus avoiding
problems with older versions of PostgreSQL.)

David P. wrote:

Do you have ActiveRecord classes that contain strings?

Do you sometimes put strings into those classes that are too wide for
the database column?

Is it really suboptimal when you get a SQL error when you .save the
object?

Are there string columns that you’d like to convert to lower case
before they’re stored in the database?

Do you like to ask rhetorical questions?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs