MOdel
Why when i put: Member.find(params[:id]).genealogy,
it tells: undefined method `genealogy'' for #<Matrix:0x4682280>
class Member < ActiveRecord::Base
set_primary_key :userid
has_many :matrix, :foreign_key => :userid
has_many :matrix, :foreign_key => :parent
def genealogy
result = matrix.clone
matrix.each do |m|
m.children.each do |c|
c.genealogy.each {|p| result << p if not result.include? p}
end
end
result
end
end
class Matrix < ActiveRecord::Base
set_table_name :matrix
set_primary_key :userid
belongs_to :member, :foreign_key => :userid
belongs_to :member, :foreign_key => :parent
acts_as_tree :foreign_key => :parent, :depdentent => false
end
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---