Skip to content

Instantly share code, notes, and snippets.

@timbeiko
Created April 3, 2015 02:06
Show Gist options
  • Save timbeiko/56a9bdcc6775d93825a4 to your computer and use it in GitHub Desktop.
Save timbeiko/56a9bdcc6775d93825a4 to your computer and use it in GitHub Desktop.
[5] pry(#<PostsController>)> @post.update(post_params)
(0.1ms) begin transaction
Category Load (0.4ms) SELECT "categories".* FROM "categories" WHERE "categories"."id" IN (1, 2, 3)
Category Load (0.1ms) SELECT "categories".* FROM "categories" INNER JOIN "post_categories" ON "categories"."id" = "post_categories"."category_id" WHERE "post_categories"."post_id" = ? [["post_id", 1]]
SQL (0.4ms) INSERT INTO "post_categories" ("category_id", "post_id") VALUES (?, ?) [["category_id", 3], ["post_id", 1]]
(31.3ms) rollback transaction
NoMethodError: undefined method `name' for nil:NilClass
from /Users/tim/.rvm/gems/ruby-2.2.0/gems/activerecord-4.0.0/lib/active_record/associations/has_many_association.rb:80:in `cached_counter_attribute_name'
[6] pry(#<PostsController>)>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment