mercredi 8 juillet 2015

Ruby on rails DRY strip whitespace from selective input forms

I'm fairly new to rails so bear with me.

I want to strip whitespace from a selective group of input forms.

But I would like a DRY solution.

So I was thinking there might be a solution such as a helper method, or a custom callback. Or a combination such as before_validation strip_whitespace(:attribute, :attribute2, etc)

One tricky part of this issue is a varying number of attributes -- so I'm thinking a loop will be required somehow.

Any help is awesome! Thanks!

Aucun commentaire:

Enregistrer un commentaire