Hello,
I've been asking Dan Kubb on IRC about the topic, and he suggested
raising it here, so here we go.
Basically, what I've repeatedly needed are associations that extend
objects accessed through them. Consider this simple example:
class User
include DataMapper::Resource
property :id, Serial
property :name, String
# etc.
has n, :friendships
has n, :friends, :through => :friendships, :class_name => 'User'
end
class Friendship
include DataMapper::Resource
property :user_id, Integer, :key => true
property :friend_id, Integer, :key => true
# now the important thing
property :ultimate_trust, Bool, :nullable => false, :default =>
false
end
Now, what I would like to do is something like:
someuser = User.first
somefriend = someuser.friends.first
puts "#{someuser.name} must really like #{somefriend.name}!" if
somefriend.ultimate_trust
i.e., the ultimate_trust attribute of the join model should somehow
become part of the associated resource when accessed through the
association.
Regards,
Nicos Gollan
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"DataMapper" 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/datamapper?hl=en
-~----------~----~----~----~------~----~------~--~---