Created
November 22, 2010 21:33
-
-
Save tanordheim/710739 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>> Organization.order("name asc").limit(5).includes([ :web_presence, :billing_address, :shipping_address, :contact_info ]) | |
Organization Load (0.4ms) SELECT "organizations".* FROM "organizations" ORDER BY name asc LIMIT 5 | |
ShippingAddress Load (0.3ms) SELECT "addresses".* FROM "addresses" WHERE ("addresses"."type" = 'ShippingAddress') AND ("addresses".addressable_id = 51 AND "addresses".addressable_type = 'Organization') LIMIT 1 | |
BillingAddress Load (0.3ms) SELECT "addresses".* FROM "addresses" WHERE ("addresses"."type" = 'BillingAddress') AND ("addresses".addressable_id = 51 AND "addresses".addressable_type = 'Organization') LIMIT 1 | |
ContactInfo Load (0.2ms) SELECT "contact_infos".* FROM "contact_infos" WHERE ("contact_infos".contactable_id = 51 AND "contact_infos".contactable_type = 'Organization') LIMIT 1 | |
WebPresence Load (0.3ms) SELECT "web_presences".* FROM "web_presences" WHERE ("web_presences".presenceable_id = 51 AND "web_presences".presenceable_type = 'Organization') LIMIT 1 | |
ShippingAddress Load (0.4ms) SELECT "addresses".* FROM "addresses" WHERE ("addresses"."type" = 'ShippingAddress') AND ("addresses".addressable_id = 57 AND "addresses".addressable_type = 'Organization') LIMIT 1 | |
BillingAddress Load (0.2ms) SELECT "addresses".* FROM "addresses" WHERE ("addresses"."type" = 'BillingAddress') AND ("addresses".addressable_id = 57 AND "addresses".addressable_type = 'Organization') LIMIT 1 | |
ContactInfo Load (0.2ms) SELECT "contact_infos".* FROM "contact_infos" WHERE ("contact_infos".contactable_id = 57 AND "contact_infos".contactable_type = 'Organization') LIMIT 1 | |
WebPresence Load (0.3ms) SELECT "web_presences".* FROM "web_presences" WHERE ("web_presences".presenceable_id = 57 AND "web_presences".presenceable_type = 'Organization') LIMIT 1 | |
ShippingAddress Load (0.2ms) SELECT "addresses".* FROM "addresses" WHERE ("addresses"."type" = 'ShippingAddress') AND ("addresses".addressable_id = 53 AND "addresses".addressable_type = 'Organization') LIMIT 1 | |
BillingAddress Load (0.4ms) SELECT "addresses".* FROM "addresses" WHERE ("addresses"."type" = 'BillingAddress') AND ("addresses".addressable_id = 53 AND "addresses".addressable_type = 'Organization') LIMIT 1 | |
ContactInfo Load (0.3ms) SELECT "contact_infos".* FROM "contact_infos" WHERE ("contact_infos".contactable_id = 53 AND "contact_infos".contactable_type = 'Organization') LIMIT 1 | |
WebPresence Load (0.4ms) SELECT "web_presences".* FROM "web_presences" WHERE ("web_presences".presenceable_id = 53 AND "web_presences".presenceable_type = 'Organization') LIMIT 1 | |
ShippingAddress Load (0.3ms) SELECT "addresses".* FROM "addresses" WHERE ("addresses"."type" = 'ShippingAddress') AND ("addresses".addressable_id = 83 AND "addresses".addressable_type = 'Organization') LIMIT 1 | |
BillingAddress Load (0.2ms) SELECT "addresses".* FROM "addresses" WHERE ("addresses"."type" = 'BillingAddress') AND ("addresses".addressable_id = 83 AND "addresses".addressable_type = 'Organization') LIMIT 1 | |
ContactInfo Load (0.2ms) SELECT "contact_infos".* FROM "contact_infos" WHERE ("contact_infos".contactable_id = 83 AND "contact_infos".contactable_type = 'Organization') LIMIT 1 | |
WebPresence Load (0.3ms) SELECT "web_presences".* FROM "web_presences" WHERE ("web_presences".presenceable_id = 83 AND "web_presences".presenceable_type = 'Organization') LIMIT 1 | |
ShippingAddress Load (0.2ms) SELECT "addresses".* FROM "addresses" WHERE ("addresses"."type" = 'ShippingAddress') AND ("addresses".addressable_id = 66 AND "addresses".addressable_type = 'Organization') LIMIT 1 | |
BillingAddress Load (0.4ms) SELECT "addresses".* FROM "addresses" WHERE ("addresses"."type" = 'BillingAddress') AND ("addresses".addressable_id = 66 AND "addresses".addressable_type = 'Organization') LIMIT 1 | |
ContactInfo Load (0.3ms) SELECT "contact_infos".* FROM "contact_infos" WHERE ("contact_infos".contactable_id = 66 AND "contact_infos".contactable_type = 'Organization') LIMIT 1 | |
WebPresence Load (0.2ms) SELECT "web_presences".* FROM "web_presences" WHERE ("web_presences".presenceable_id = 66 AND "web_presences".presenceable_type = 'Organization') LIMIT 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Organization < ActiveRecord::Base | |
has_one :shipping_address, :as => :addressable | |
has_one :billing_address, :as => :addressable | |
has_one :contact_info, :as => :contactable | |
has_one :web_presence, :as => :presenceable | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment