Skip to content

Instantly share code, notes, and snippets.

@MikeSilvis
Created July 21, 2013 06:39
Show Gist options
  • Save MikeSilvis/6047733 to your computer and use it in GitHub Desktop.
Save MikeSilvis/6047733 to your computer and use it in GitHub Desktop.
2.0.0p247 :001 > v = Vehicle.first
Vehicle Load (1.1ms) SELECT "vehicles".* FROM "garages" LIMIT 1
=> #<Vehicle id: 3, model_id: 1, year: 2013, color_id: 9, user_id: 2, created_at: "2013-07-06 20:03:52", updated_at: "2013-07-06 20:03:52">
2.0.0p247 :002 > v.model
Model Load (1.0ms) SELECT "models".* FROM "models" WHERE "models"."id" = 1 LIMIT 1
=> #<Model id: 1, name: "e90 M3 Sedan", make_id: 12, created_at: "2013-05-30 05:05:21", updated_at: "2013-07-15 03:58:05">
2.0.0p247 :003 > v.make
Make Load (0.7ms) SELECT "makes".* FROM "makes" WHERE "makes"."id" = 12 LIMIT 1
=> #<Make id: 12, name: "BMW", created_at: "2013-05-30 05:06:18", updated_at: "2013-05-30 05:06:18">
2.0.0p247 :004 > v.color
Color Load (0.8ms) SELECT "colors".* FROM "colors" WHERE "colors"."id" = 9 LIMIT 1
=> #<Color id: 9, name: "Alpine White", created_at: "2013-05-30 05:05:22", updated_at: "2013-05-30 05:05:22">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment