Forum: Ruby on Rails Class/Subclass and has_many belongs_to

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
04e5acfc942c342c3df54686061fe72d?d=identicon&s=25 Alberto (Guest)
on 2007-03-05 20:31
Hi:

I would appreciate some hint. I can't modify Class A1 but I can subclass
it so I wonder how can I get access to its belongs_to and has_many i.e.

Class A1 < ActiveRecord::Base
belongs_to : B1
belongs_to : C1
has_many :D1

end

Class myClass < ActiveRecord::A1
end

The above doesn't work.. Well it doesn't do the insert ..

MyClass and A1 table are exactly the same. Any suggestions?

Regards.
2f24c382600d9fd71085a74251fd5a39?d=identicon&s=25 Damian Terentyev (Guest)
on 2007-03-08 16:55
(Received via mailing list)
Try to write the second class as

Class myClass < A1
end

Class A1 It is not in module ActiveRecord, is it?
This topic is locked and can not be replied to.