-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Trying to use acts_as_relation and getting unexpected results. #26
Comments
A game is a node an belongs to another node? Even if this is the case, This was what I got on the first look. I am going on a trip with no
|
So, yes, Games belong to and are Nodes. Teams are also Nodes. Games 1) must have two "ancestors", which can be either a Game or a Team, 2) eventually have another Team (which relationship is not shown for purposes of clarity). Part of your comment doesn't make much sense to me (which suggests I'm doing something wrong): "We don't usually use a model name as a polymorphic relation name." I went through several iterations of code attempting to get a working relationship, and what you see above was the version that managed to get through the compile step. Previous attempts included this combination: class Node < ActiveRecord::Base
acts_as_superclass
belongs_to :ancestor, polymorphic: true
# ...
end
class Game < ActiveRecord::Base
acts_as :node
has_many :nodes, as: :ancestor
# ...
end Those would fail because |
Maybe it's to late! But why |
Not too late (I'm always looking to understand what I missed the first time through). In the earlier attempt, I was trying to express the relationship that Nodes, being the superclass, were potentially either Games or Teams. I've been away from this for some time. So, if I'm saying something incomprehensible, it may be a lack of memory or a genuine lack of understanding something. If you could be more verbose and explicit, that would be helpful. |
I have the following relationships via
acts_as_relation
:When I add a
Game
to the list ofancestors
in anotherGame
, I get:If I examine the Game object in the debugger,
object.is_a? Node
returnsfalse
, which makes no sense, given the above.Do you have any suggestions for how I can proceed? This is rails 3.2.12 under ruby 1.9.3.
The text was updated successfully, but these errors were encountered: