I've been using the 3.1.2 gem from github.
Looking at line 73/74 of lib/active_scaffold/attibute_params.rb via the
github code browser, I don't see anything different from what is in my
gem. So while I can see about pulling the latest commit, I doubt it's
going to clarify anything.
Ryan
On Fri, 30 Sep 2011, Sergio Cambra .:: entreCables S.L. ::. wrote:
On Viernes, 30 de Septiembre de 2011 16:42:26 Ryan Moats escribió:
Final update... once I looked at the associations in Fief again it
dawned on me that the ones I was tripping over are incomplete
specifications and confuse AS because it can't find the other end.
Correct specification for the four associations are:
has_many :lent_forces, :class_name => "LentForce", :foreign_key =>
"sourceFief_id", :inverse_of => :lending_fief
has_many :borrowed_forces, :class_name => "LentForce", :foreign_key
=> "holderFief_id", :inverse_of => :lessee_fief
has_many :prisoners, :class_name => "Prisoner", :foreign_key =>
"sourceFief_id", :inverse_of => :owning_fief
has_many :held_prisoners, :class_name => "Prisoner", :foreign_key =>
"holderFief_id", :inverse_of => :holding_fief
and then creating a World works.
So, bottom line is that I'd like to see the error message in this case
be a bit more useful - I spent a day on a wild goose chase based on
what the error said instead of the 30 minutes that it took once I got
on the right track.
However, looking at the code that raises this error, it's not obvious
to me how to make the statement more descriptive...
Ryan
On Sep 30, 8:55 am, Ryan Moats <[email protected]> wrote:
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
Are you using rails 3.1? Can you check with last commit if error message is
better now?
--
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.