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.
Alberto (Guest)
on 2007-03-05 21: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.
Damian T. (Guest)
on 2007-03-08 17: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.