class ContentLink < ActiveRecord::Base belongs_to :content_node, :class_name => "ContentNode", :foreign_key => "target_id" acts_as_nested_set(:parent_column => "ancestor_id") def full_xml(builder=nil) # add something here to get the content, not the assignment to_xml(:builder => builder, :skip_instruct => true) do |xml| children.each { |child| child.full_xml(xml) } end end def self.find_parent_content_by_content_id(content_id) @parent_content = find(:all, :conditions => {:content_id => content_id}).parent.content return @parent_content end #before filter on controller: def title #name += "Link between #{source} and #{target}" end end