Re: [Rails] Re: Re: STI and nested object on subclass

2010-09-14 Thread Daniel Gaytán
Hello Javier I don't know what would happen, I installed rails 2.3.9 to try the same code I wrote in rails 3 and worked like a charm. There is something weird in your code since the table name for Person model should be People... I don't know if there is a problem with your ActiveRecord or maybe

Re: [Rails] Re: Re: STI and nested object on subclass

2010-09-13 Thread Javier Ruiz
Hi Daniel Thanks for helping :-) This is exactly how I was thinking it should work. But I just tried using set_table_name and I still got the same result, for example, using your code (which is exactly what I'd love to do), I get this: w = Worker.create(:name => "WorkerName") # ok p = Person.cre

Re: [Rails] Re: Re: STI and nested object on subclass

2010-09-13 Thread Daniel Gaytán
Hello Javier, I was just checking the set_table_name class method of ActiveRecord and I think that could work for you: class AnotherClass < ActiveRecord::Base has_one :worker end class Person < ActiveRecord::Base def something self.name end end class Worker < Person set_table_name

[Rails] Re: Re: STI and nested object on subclass

2010-09-13 Thread Marnen Laibow-Koser
[Please quote when replying. Otherwise the discussion is impossible to follow.] Javier Ruiz wrote: > Yep that's finally how I will have to do it... but this is not what I > wanted. A has_one relation means that I have to access things like: > > Anotherclass.property > Anotherclass.childclass.sp