Single Table Inheritance Association Issue

Discussion in 'Ruby' started by Mike, Mar 12, 2007.

  1. Mike

    Mike Guest

    Hi there,

    I'm using STI in a new application, and something is terribly wrong with
    has_many associations.

    Right, so I have number of subclasses that inherit from one concrete
    base class. Each sub class can possibly have associations via has_many,
    or has_one. When I try to access a collection on the sub class(
    subclass.items), I get 'undefined method 'items' for <Subclass>'. The
    strange thing is, accessing these subclasses in script/console works
    fine, and even works the first time I run the app in some cases. Once I
    refresh the page I get this error though.

    I'm totally at a loss here. Any help would be greatly appreciated!

    Thanks in advance.

    Mike.

    --
    Posted via http://www.ruby-forum.com/.
    Mike, Mar 12, 2007
    #1
    1. Advertising

  2. Mike

    Phrogz Guest

    On Mar 12, 10:02 am, Mike <> wrote:
    > I'm using STI in a new application, and something is terribly wrong with
    > has_many associations.

    [snip]
    > I'm totally at a loss here. Any help would be greatly appreciated!


    You have posted this question to the ruby-talk forum/newsgroup/mailing
    list, which is for general discussion of the Ruby language. You will
    probably get a better set of responses if you ask this question on the
    ruby-on-rails forum/group, which is for rails-specific questions, as
    yours is.

    http://groups.google.com/group/rubyonrails-talk
    Phrogz, Mar 12, 2007
    #2
    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. Replies:
    1
    Views:
    263
    Chris Brat
    Oct 4, 2006
  2. Ryan Glover

    Modified Single Table Inheritance

    Ryan Glover, Dec 26, 2006, in forum: Ruby
    Replies:
    8
    Views:
    132
    Stephen Richards
    Dec 31, 2006
  3. Tobias
    Replies:
    1
    Views:
    146
    Tobias
    Jan 21, 2007
  4. Greg Ma

    Find by association table

    Greg Ma, Feb 16, 2010, in forum: Ruby
    Replies:
    4
    Views:
    115
    Josh Cheek
    Feb 16, 2010
  5. Mothra
    Replies:
    10
    Views:
    466
    Anno Siegel
    Mar 11, 2005
Loading...

Share This Page