about 6 years ago
In Self join association one model has relation with itself. For example one user table can have list of all coach and player. One coach can train many players. We will represent the association as:
class User < ActiveRecord::Base
has_many :players, :class_name => "User", :foreign_key => "coach_id"
belongs_to :coach, :class_name => "User"
With the above self join association we can retrieve all the players under a coach as @coach.players and coach of a player as @player.coach.
Starting with Chrome version 45, NPAPI is no longer supported for Google Chrome. For more information, see Chrome and NPAPI (blog.chromium.org).
Firefox and Microsoft Internet Explorer are recommended browsers for websites using java applets.
Chrome Version Support
Are you sure, you want to delete this comment?
Terms of Service
| © copyright 2021 FindNerd.com. All rights reserved.
Sign up using