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
> Regards, Zdravko
>
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/049afd0291e817ad42d87dd720ffd0a0%40ruby-forum.com.
> For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLtPySN%3D6tnO2Gg2JCoudcWH%3DTZUbPvwKa_cZQoX%3D9xBkw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment