An update on this topic. After chasing down the inflection rathole for most of yesterday, I pulled back out and went back to simple A/B testing of Fief. It turns out that the error message is rather misleading (and I guess you can count this as a "grump") as the problem is not the association between World and Fief as is reported, but the issue is between Fief and a pair of classes that each have a pair of foreign keys back to the Fief table.
What I'm bumping against is the following definitions in Fief: has_many :lent_forces, :inverse_of => :lending_fief # has_many :borrowed_forces, :inverse_of => :lessee_fief has_many :prisoners, :inverse_of => :owning_fief # has_many :held_prisoners, :inverse_of => :holding_fief the first two "has many" declarations match up with the following lines in LentForces: belongs_to :lending_fief, :foreign_key => "sourceFief_id", :class_name => "Fief" belongs_to :lessee_fief, :foreign_key => "holderFief_id", :class_name => "Fief" while the second two match up with the following lines from Prisoner: belongs_to :owning_fief, :foreign_key => "sourceFief_id", :class_name => "Fief" belongs_to :holding_fief, :foreign_key => "holderFief_id", :class_name => "Fief" With the lines from Fief shown commented above, I can add a new World via AS. If I uncomment either of them, then I trip the error. So, there is a problem, but it's not where it's reported. More as I chase this down... Ryan On Sep 29, 10:14 am, Ryan Moats <[email protected]> wrote: > Ok, I admit it... I'm stumped. > > I've a master world record that has multiple has_many associations: > > class World < ActiveRecord::Base > has_many :bishoprics > has_many :city_towns > has_many :kingdoms > has_many :fiefs > end > > Each of the other classes (Bishopric, CityTown, Kingdom and Fief) has a > matching "belong_to :world" association. > > Now, if I comment out the "has_many :fiefs" association, I can create a > new world. If I uncomment the association, then I run into the dreaded > ReverseAssociationRequired error message on the association "fiefs" > claiming it doesn't have the belong_to for world and it does: > > class Fief < ActiveRecord::Base > belongs_to :world > ... > end > > I checked the pluralization of fief that the inspector returns (via the > console) and got the right answer (fiefs). So, why the error? > > Any help is appreciatd. > > Ryan Moats -- You received this message because you are subscribed to the Google Groups "ActiveScaffold : Ruby on Rails plugin" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/activescaffold?hl=en.
