Help, do i need to validates_length_of these?

Hi, i’m using postgres and rails, and i’ve some fields, like first name,
last name, etc, i’ve set it with the migration to a maximum of 50 chars,
and i’ve limited in the view the possibility to insert more than 50
chars… have i also to add a validates_length_of in the model for all
of these fields? Which problems may i have to don’t put it?

Hi, i’m using postgres and rails, and i’ve some fields, like first name,
last name, etc, i’ve set it with the migration to a maximum of 50 chars,
and i’ve limited in the view the possibility to insert more than 50
chars… have i also to add a validates_length_of in the model for all
of these fields? Which problems may i have to don’t put it?

Any chance you’ll ever manage that data outside of your views? Perhaps
in
a custom script, or via ./script/console? It certainly doesn’t hurt to
do
it there as well…

Hi Mike,

mike wrote:

Hi, i’m using postgres and rails, and i’ve some fields, like first name,
last name, etc, i’ve set it with the migration to a maximum of 50 chars,
and i’ve limited in the view the possibility to insert more than 50
chars… have i also to add a validates_length_of in the model for all
of these fields? Which problems may i have to don’t put it?

I’ve been told that if I don’t validate in my model, my application is
potentially open to non-browser based attacks, both on the app and on
the
database.

hth,
Bill

Bill W. wrote:

I’ve been told that if I don’t validate in my model, my application is
potentially open to non-browser based attacks, both on the app and on
the
database.

hth,
Bill

ok, i think i’ll put it on all of them :slight_smile: