Displaying 1 result from an estimated 1 matches for "parlevel".
2008 Apr 23
1
Validation dependent on unsaved parent
...ave a sort-of workaround using
validation code in the parent, but that violates DRY. The validation
still has to be in the child because the child can be updated without
the parent validation coming into play.
Here''s the code:
=============
class Item < ActiveRecord::Base
has_many :parlevels
has_many :locations, :through => :parlevels
has_many :line_items
has_many :orders, :through => :line_items
end
class Location < ActiveRecord::Base
has_many :orders
has_many :parlevels
has_many :items, :through => :parlevels
end
class Parlevel < ActiveRecord::Base
bel...