Removing empty fields before saving

When I save data, form submits some empty (but not null) data.
How can I remove that?

Thanks.

When I save data, form submits some empty (but not null) data.
How can I remove that?

Write a before_save method on your model that looks at each attribute
and if it’s a blank string set it to nil. I can’t think of the name,
but someone wrote a plugin that does exactly this.

plugin-

StripAttributes

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs