Hi there! I'm trying to create an inheritance between two classes where the child class has its own relations... but I it looks like the concept in rails is a bit different than in other languages/framworks (or I'm doing something wrong).
Let's say I have this two model classes, parent and child class, and a relation to the child class: class Parentclass < ActiveRecord::Base end ## this child class has a anotherclass_id class Childclass < Parentclass end class Anotherclass < ActiveRecord::Base has_one :childclass end My problem is that, when I try to access the relation to the child class, rails tries to find the relation id in the parent class! I mean I get this... >> a = Anotherclass.find(1) >> a.childclass ActiveRecord::StatementInvalid: Mysql::Error: Unknown column 'parentclasses.anotherclass_id' in 'where clause': SELECT * FROM `parentclasses` WHERE (`parentclasses`.anotherclass_id = 1) LIMIT 1 I even tried to force the class name like: class Anotherclass < ActiveRecord::Base has_one :childclass, :class_name => "Childclass" end But same thing, the has_one relation goes to parent class to try to find the relational id. Anyone can help with this please?? Thanks in advance! -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.