Rails has_many self -ferential
Mam następujący model kont (uproszczony):
class Account < ActiveRecord::Base
attr_accessible :account_number, :display_name, :master_account_id
has_many :child_accounts, :class_name => "Account", :foreign_key => "id"
belongs_to :master_account, :class_name => "Account", :foreign_key => "master_account_id"
end
@account.master_account
obecnie działa poprawnie, ale chcę też mieć dostęp@account.child_accounts
- co muszę zrobić, aby to naprawić?