I am trying to define a before_save method in an object. I would like
to call a function like sanitize or simple_format. These are view
functions. Is there any way, short of writing my own functions, to
sanitize a user's text input BEFORE it is saved to the database rather
than after?
I am trying to define a before_save method in an object. I would like
to call a function like sanitize or simple_format. These are view
functions. Is there any way, short of writing my own functions, to
sanitize a user's text input BEFORE it is saved to the database rather
than after?
IMHO it is a gigantic deficiency of Rails that there is not an
out-of-the-box way to do this. h() is good but why filter output in 100
places when you can filter input once?
well, you can... exactly as described above or write your own
methods. IMHO it's not rails' place to do this automatically - you
might want to have those special characters in the db.