Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ruby on Rails: Is there a way to make blank form inputs submit nil? [duplicate]

Possible Duplicate:
Make blank params[] nil

Is there a way to make blank form inputs submit nil? Right now, I'm going through and in a before_save manually converting all "" into nil.

This really doesn't seem very DRY, and I feel like I must be missing something.

like image 491
William Jones Avatar asked Jun 24 '10 21:06

William Jones


1 Answers

Check out the attribute_normalizer plugin.

like image 178
Andrew Vit Avatar answered Oct 28 '22 08:10

Andrew Vit