Cannot skip validation in Rails 3?

Sigh...* Found the problem... one of my after_validate method calls was adding information and resaving the model, hence the errors I was getting weren't from the console input, they were coming from the after_validate method which was saving again. Thanks all.

Instead of placing an invalid model in the database, store the partially completed model (created with Model. New) in a session. Only save it to the database when it is completely valid.

That would be nice, but I can't. I have file attachments etc. That have to be submitted as part of the model, and for those to save correctly during the creation process they have to already know what the ID of the parent object is going to be. – Andrew Jan 14 '11 at 20:05.

It is a bad practice to have invalid models saved by normal use cases. Use conditional validations instead: validates_presence_of :title, :unless => :in_first_stage? Or if you have many: with_options :unless => :in_first_stage?

Do validates_presence_of :title validates_presence_of :author end This way nothing stands in way to have nightly integrity tests, which checks all records for validity. A valid use case for saving without validations would be for testing edge cases, e.g. To test that a database constraint is enforced.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions