user1170896
user1170896

Reputation: 739

Rails reject fields

I'm trying to achieve the same thing for nested attributes but for first level attributes. I would like to reject/ignore/skip some fields if a Proc evaluates to true. Is there anyway of doing this without define a before_save hook? Thanks

Upvotes: 0

Views: 586

Answers (1)

varatis
varatis

Reputation: 14750

You mean validations?

http://guides.rubyonrails.org/active_record_validations_callbacks.html#validation-helpers

If you want to set some fields to nil before saving it, the best way is to do that with a before_save or before_create.

Upvotes: 1

Related Questions