Validates_associated

Is the any way to get more descriptive of the errors associated with
the associated model?

I have a site model that has:

validates_associated :Eqptattrs

and below is the error generated from the associated model.

There were problems with the following fields:

* Eqptattrs is invalid

Chris H. wrote:

Is the any way to get more descriptive of the errors associated with
the associated model?

I have a site model that has:

validates_associated :Eqptattrs

and below is the error generated from the associated model.

There were problems with the following fields:

* Eqptattrs is invalid

If i were you, i would provide the model itself to help others
investigate the issue clearly.

okie dokie

class Eqptattr < ActiveRecord::Base
belongs_to :site
belongs_to :equipment

validates_presence_of :ip

end

class Site < ActiveRecord::Base
has_many :eqptattrs, :dependent => :destroy
has_many :equipments, :through => :eqptattrs

validates_uniqueness_of :name
validates_associated :eqptattrs

end

class Equipment < ActiveRecord::Base
has_many :eqptattrs, :dependent => :destroy
has_many :sites, :through => :eqptattrs
end

On Aug 13, 3:46 pm, Rails L. [email protected]

I also use this kind of validations in another project and I get the
same general error. Is there a better way to handle these kind of
association errors?

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