Actually, it seems I was kind of rubber ducking here :) I found out the
answer just after I sent the mail. It should of course be has_one
instead of belongs_to.
/Marcus
marcus wrote:> I have a model where I have a tree of nodes in one table (acts_as_tree)
> where I also use a type column to get inheritance. In this table I also
> have a data_id column that refers to another row in another table (the
> subclass knows what table).
>
> I also have another class that have this line
>
> class Page < ActiveRecord::Base
> belongs_to :node,
> :foreign_key => "data_id",
> :conditions => "type ==
''PageNode''"
> ...
>
> It''s supposed to refer back to the Node class so I can get to the
node
> from a Page instance using
>
> @page.node.what_ever
>
> The problem now is that @page.node == nil. I have checked the tables and
> the data is correct (it must be since navigation from node to page works
> perfectly)
>
> Any ideas?
>
> Thanks
>
> /Marcus
>
>
> _______________________________________________
> Rails mailing list
> Rails@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>
>