Spencer
Spencer

Reputation: 22418

Rails force object to save even when validation fails

I want to force a save of an object even when a validation fails. I tried doing this

te.save(:validate => false)

However, this did not seem to work. What is the right way to do this?

Upvotes: 3

Views: 2998

Answers (1)

KARASZI István
KARASZI István

Reputation: 31477

That's the way according to the source of save_with_validation.

Are you sure it's not saved? Maybe you have database constraints which keep you from saving your object.

Have you checked your logs looking for INSERTs or UPDATEs?

Upvotes: 4

Related Questions