Forum: Ruby on Rails extending activeRecord with activeResource

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.
532f1f431c4b073b3bfb0237b6597a3c?d=identicon&s=25 Zdravko Balorda (zdravko)
on 2016-03-03 21:25
How to extend ActiveRecord from database with additional columns from
ActiveResource?
I have an ActiveRecord class Person which I need to extend with columns
from remote database which I can access with ActiveResource class Party.
Can Party be seemlessly integrated into Person?
Regards, Zdravko
4c6bde00168d595053c09aac7e487f8e?d=identicon&s=25 Colin Law (Guest)
on 2016-03-03 21:50
(Received via mailing list)
On 3 March 2016 at 20:25, Zdravko Balorda <lists@ruby-forum.com> wrote:
> How to extend ActiveRecord from database with additional columns from
> ActiveResource?
> I have an ActiveRecord class Person which I need to extend with columns
> from remote database which I can access with ActiveResource class Party.
> Can Party be seemlessly integrated into Person?

There may be other ways, but unless someone provides a better solution
I would setup a has_one belongs_to relationship between them, and then
if you really want to avoid having to do @person.party.field then
define accessor methods in Person so that @person.field references
self.party.field

Colin
This topic is locked and can not be replied to.