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 Habgood 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 invalidIf i were you, i would provide the model itself to help others investigate the issue clearly. -- Posted via http://www.ruby-forum.com/.
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 List <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Chris Habgood 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. > -- > Posted viahttp://www.ruby-forum.com/.
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? On Aug 13, 6:38 pm, Me <chabg...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> 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 List <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > wrote: > > > Chris Habgood 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. > > -- > > Posted viahttp://www.ruby-forum.com/.