search for: self_and_descend

Displaying 1 result from an estimated 1 matches for "self_and_descend".

2007 Jan 31
2
has_many :conditions
Is it possible to put conditions relative to the current instance in has_many''s :conditions? For example, in a forum app: class Post < ActiveRecord::Base belongs_to :topic has_many :self_and_descendants, :class_name => "Post", :order => "lft", :conditions => "topic_id = #{topic_id} AND (lft BETWEEN #{lft} AND #{rgt})" end With the above code, I get the following exception: undefined local variable or method `topic_id'' for Post:Class I...