Validations

I wrote a model, who save two attributes in the database. the first
attribute is a date and the second a describtion. I wrote a validation,
who check every date. I would only save a record, when the date is
greater than the saved one. That’s running now - yupie!

But I would like to update the describtion of every record after the
event. Thats the problem. My validation didn’t accept the update,
because the date is younger than the last saved one.

So I would the validation, but I also want to update every record.

Thanks for your help!

M. R. wrote:

But I would like to update the describtion of every record after the
event. Thats the problem. My validation didn’t accept the update,
because the date is younger than the last saved one.

The solution is validate_on_create. The validation block runs only in
the creation phase. So the problem is solved.

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