self referential belongs_to

Discussion in 'Ruby' started by Aryk Grosz, Jun 26, 2008.

  1. Aryk Grosz

    Aryk Grosz Guest

    I noticed that eager loading a belongs to association that points back
    to an item of the same class is causing AR to lock up.

    For example

    class Layout < ActiveRecord::Base

    belongs_to :flipped_layout, :class_name => "Layout", :foreign_key =>
    "flipped_layout_id"
    end

    So when I do, Layout.find:)all, :include => :flipped_layout), it locks
    up.

    Am I doing something wrong or this a known bug with Rails?
    --
    Posted via http://www.ruby-forum.com/.
     
    Aryk Grosz, Jun 26, 2008
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John
    Replies:
    0
    Views:
    458
  2. Anthony Heading

    typenames in self-referential templates

    Anthony Heading, Sep 24, 2003, in forum: C++
    Replies:
    9
    Views:
    460
    Shane Beasley
    Sep 25, 2003
  3. SpeedBump
    Replies:
    1
    Views:
    406
    David B. Held
    Nov 4, 2003
  4. Risto Lankinen

    Self-referential initialization

    Risto Lankinen, Nov 13, 2003, in forum: C++
    Replies:
    1
    Views:
    368
    tom_usenet
    Nov 13, 2003
  5. Joe
    Replies:
    5
    Views:
    536
    Barry Schwarz
    Dec 13, 2003
Loading...

Share This Page