Forum: Ruby on Rails A "virtual model" that encapsulates other models?

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.
Fcdafe495dccc04d27f6dbbcdf54aecc?d=identicon&s=25 Woei Shyang (generik)
on 2006-03-24 14:37
Hi,

Is it possible to have a model in rails that does not exist as a
database table by itself, but it exists solely by pulling data together
from tables used by other models?

For instance, let's say I have a model of a "customer" which has_many
"addresses", of which one of the "addresses" is the default address.

So what I'd like to do is to actually have a model, say
"Shipping_Addresses" that pulls "First name" and "Last name" out from
"customer" and sticks it to the rest of the address details as pulled
from "addresses".

Is this doable?
This topic is locked and can not be replied to.