Skip to content

Instantly share code, notes, and snippets.

@deJaVisions
Created February 26, 2012 01:45
Show Gist options
  • Select an option

  • Save deJaVisions/1912179 to your computer and use it in GitHub Desktop.

Select an option

Save deJaVisions/1912179 to your computer and use it in GitHub Desktop.
1.9.3-p0 :001 > p = Product.create(title: "Test Product 1")
(0.1ms) begin transaction
SQL (62.0ms) INSERT INTO "products" ("created_at", "title", "updated_at") VALUES (?, ?, ?) [["created_at", Sun, 26 Feb 2012 01:41:35 UTC +00:00], ["title", "Test Product 1"], ["updated_at", Sun, 26 Feb 2012 01:41:35 UTC +00:00]]
(23.4ms) commit transaction
=> #<Product id: 1, title: "Test Product 1", created_at: "2012-02-26 01:41:35", updated_at: "2012-02-26 01:41:35">
1.9.3-p0 :002 > m = Material.create(title: "Iron")
(0.1ms) begin transaction
SQL (0.7ms) INSERT INTO "materials" ("created_at", "title", "updated_at") VALUES (?, ?, ?) [["created_at", Sun, 26 Feb 2012 01:41:43 UTC +00:00], ["title", "Iron"], ["updated_at", Sun, 26 Feb 2012 01:41:43 UTC +00:00]]
(44.0ms) commit transaction
=> #<Material id: 1, title: "Iron", created_at: "2012-02-26 01:41:43", updated_at: "2012-02-26 01:41:43">
1.9.3-p0 :003 > p.materials << m
ActiveRecord::HasManyThroughAssociationNotFoundError: Could not find the association :products_materials in model Product
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment