projectblacklight / spotlight

Spotlight enables librarians, curators, and others who are responsible for digital collections to create attractive, feature-rich websites that highlight these collections.
Other
161 stars 64 forks source link

Validate title length on pages #1201

Open peetucket opened 9 years ago

peetucket commented 9 years ago

When editing a page, if you add a big blob of text (very long title), and click submit you'll get an exception:

Mysql2::Error: Data too long for column 'title' at row 1:
cbeer commented 9 years ago

It looks like this gem might fix errors like this downstream:

https://github.com/SchemaPlus/schema_validations

Maybe we should add that to sul-exhibits-template and see how it works? I'm hesitating requiring all spotlight users to use that gem, but maybe we could recommend it in some docs?

peetucket commented 9 years ago

:+1: You can also turn off automatic validations by default and then do it by model (if there are models where this automatic behavior is not desired).

cbeer commented 9 years ago

I just tried this gem in sul-exhibits-template, and it may be more trouble than it's worth. It seems like it has trouble with value coercion (or, i submitted a form with an optional, blank value, and it complained that it wasn't an integer..) If we want to use them gem, I think we'll have to whitelist the properties we actually care about.