Consider 2 tables:
Player-> column player_id
and
Hit-> columns player_id, hit_player_id
I want one model for Player and one model for a Hit.
Any player has many hits against another player.
So from a Player I want to be able to get all the Hits, and from the
Hit get the hit Player.
On the other hand, from a Player I want to retrieve all Hits against
that player (were player_id = hits.hit_player_id)
and the player_id from that hit.
So far I have:
class Player < ActiveRecord::Base
has_many :hits
end
and
class Hit < ActiveRecord::Base
belongs_to :player
end
But I can't figure out how to map the 'hit' player.
Thanks for the help!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" 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/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---