Validation with has_one associated models

Is Rails designed to validate differently with the has_one model
association or is it a bug? I find myself having to code around my
validation differently and wasn’t sure if others thought it was an
issue as well.

For example if employee HAS_ONE manager:

my_employee.manager = invalid_manager
my_employee.save
=> true

Shouldn’t my_employee.save return false since the invalid_manager was
unable to save?

Thanks,
Tom

On 9/5/07, TomRossi7 [email protected] wrote:

=> true

Shouldn’t my_employee.save return false since the invalid_manager was
unable to save?

you need to use validates_associated

http://api.rubyonrails.com/classes/ActiveRecord/Validations/ClassMethods.html#M000948

Adam

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