{"action":"created","issue":{"url":"https://api.github.com/repos/mbleigh/acts-as-taggable-on/issues/612","repository_url":"https://api.github.com/repos/mbleigh/acts-as-taggable-on","labels_url":"https://api.github.com/repos/mbleigh/acts-as-taggable-on/issues/612/labels{/name}","comments_url":"https://api.github.com/repos/mbleigh/acts-as-taggable-on/issues/612/comments","events_url":"https://api.github.com/repos/mbleigh/acts-as-taggable-on/issues/612/events","html_url":"https://github.com/mbleigh/acts-as-taggable-on/issues/612","id":51098733,"number":612,"title":"NoMethodError: undefined method `reload' for nil:NilClass","user":{"login":"fascox","id":700221,"avatar_url":"https://avatars.githubusercontent.com/u/700221?v=3","gravatar_id":"","url":"https://api.github.com/users/fascox","html_url":"https://github.com/fascox","followers_url":"https://api.github.com/users/fascox/followers","following_url":"https://api.github.com/users/fascox/following{/other_user}","gists_url":"https://api.github.com/users/fascox/gists{/gist_id}","starred_url":"https://api.github.com/users/fascox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fascox/subscriptions","organizations_url":"https://api.github.com/users/fascox/orgs","repos_url":"https://api.github.com/users/fascox/repos","events_url":"https://api.github.com/users/fascox/events{/privacy}","received_events_url":"https://api.github.com/users/fascox/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2014-12-05T13:29:03Z","updated_at":"2016-02-22T22:33:48Z","closed_at":"2015-02-11T08:45:14Z","body":"trying to remove an object with tags throws this exception:\r\n\r\nirb(main):017:0> a = Article.find 7002\r\nirb(main):018:0> a.destroy\r\n\r\nNoMethodError: undefined method `reload' for nil:NilClass\r\n\tfrom /home/nikeita/fastroad/shared/bundle/ruby/2.1.0/gems/acts-as-taggable-on-3.4.2/lib/acts_as_taggable_on/tagging.rb:36:in `remove_unused_tags'\r\n\tfrom /home/nikeita/fastroad/releases/132/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.6/lib/active_support/callbacks.rb:424:in `block in make_lambda'\r\n\tfrom /home/nikeita/fastroad/releases/132/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.6/lib/active_support/callbacks.rb:221:in `call'\r\n\tfrom /home/nikeita/fastroad/releases/132/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.6/lib/active_support/callbacks.rb:221:in `block in halting_and_conditional'\r\n\tfrom /home/nikeita/fastroad/releases/132/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.6/lib/active_support/callbacks.rb:86:in `call'\r\n\tfrom /home/nikeita/fastroad/releases/132/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.6/lib/active_support/callbacks.rb:86:in `run_callbacks'\r\n\tfrom /home/nikeita/fastroad/releases/132/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.6/lib/active_record/callbacks.rb:292:in `destroy'\r\n\tfrom /home/nikeita/fastroad/releases/132/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.6/lib/active_record/transactions.rb:263:in `block in destroy'\r\n\tfrom /home/nikeita/fastroad/releases/132/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.6/lib/active_record/transactions.rb:329:in `block in with_transaction_returning_status'\r\n\tfrom /home/nikeita/fastroad/releases/132/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.6/lib/active_record/connection_adapters/abstract/database_statements.rb:199:in `transaction'\r\n\tfrom /home/nikeita/fastroad/releases/132/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.6/lib/active_record/transactions.rb:208:in `transaction'\r\n\tfrom /home/nikeita/fastroad/releases/132/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.6/lib/active_record/transactions.rb:326:in `with_transaction_returning_status'\r\n\tfrom /home/nikeita/fastroad/releases/132/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.6/lib/active_record/transactions.rb:263:in `destroy'\r\n\tfrom /home/nikeita/fastroad/releases/132/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.6/lib/active_record/persistence.rb:167:in `destroy!'\r\n\tfrom /home/nikeita/fastroad/releases/132/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.6/lib/active_record/associations/has_many_association.rb:112:in `each'\r\n\tfrom /home/nikeita/fastroad/releases/132/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.6/lib/active_record/associations/has_many_association.rb:112:in `delete_records'\r\n... 25 levels...\r\n\tfrom /home/nikeita/fastroad/releases/132/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.6/lib/active_record/transactions.rb:263:in `destroy'\r\n\tfrom (irb):18\r\n\tfrom /home/nikeita/fastroad/releases/132/vendor/bundle/ruby/2.1.0/gems/railties-4.1.6/lib/rails/commands/console.rb:90:in `start'\r\n\tfrom /home/nikeita/fastroad/releases/132/vendor/bundle/ruby/2.1.0/gems/railties-4.1.6/lib/rails/commands/console.rb:9:in `start'\r\n\tfrom /home/nikeita/fastroad/releases/132/vendor/bundle/ruby/2.1.0/gems/railties-4.1.6/lib/rails/commands/commands_tasks.rb:69:in `console'\r\n\tfrom /home/nikeita/fastroad/releases/132/vendor/bundle/ruby/2.1.0/gems/railties-4.1.6/lib/rails/commands/commands_tasks.rb:40:in `run_command!'\r\n\tfrom /home/nikeita/fastroad/releases/132/vendor/bundle/ruby/2.1.0/gems/railties-4.1.6/lib/rails/commands.rb:17:in `<top (required)>'\r\n\tfrom /home/nikeita/fastroad/releases/132/vendor/bundle/ruby/2.1.0/gems/railties-4.1.6/lib/rails/app_rails_loader.rb:43:in `require'\r\n\tfrom /home/nikeita/fastroad/releases/132/vendor/bundle/ruby/2.1.0/gems/railties-4.1.6/lib/rails/app_rails_loader.rb:43:in `block in exec_app_rails'\r\n\tfrom /home/nikeita/fastroad/releases/132/vendor/bundle/ruby/2.1.0/gems/railties-4.1.6/lib/rails/app_rails_loader.rb:32:in `loop'\r\n\tfrom /home/nikeita/fastroad/releases/132/vendor/bundle/ruby/2.1.0/gems/railties-4.1.6/lib/rails/app_rails_loader.rb:32:in `exec_app_rails'\r\n\tfrom /home/nikeita/fastroad/releases/132/vendor/bundle/ruby/2.1.0/gems/railties-4.1.6/lib/rails/cli.rb:5:in `<top (required)>'\r\n\tfrom /home/nikeita/fastroad/releases/132/vendor/bundle/ruby/2.1.0/gems/railties-4.1.6/bin/rails:9:in `require'\r\n\tfrom /home/nikeita/fastroad/releases/132/vendor/bundle/ruby/2.1.0/gems/railties-4.1.6/bin/rails:9:in `<top (required)>'\r\n\tfrom bin/rails:16:in `load'\r\n\tfrom bin/rails:16:in `<main>'irb(main):019:0>"},"comment":{"url":"https://api.github.com/repos/mbleigh/acts-as-taggable-on/issues/comments/187419052","html_url":"https://github.com/mbleigh/acts-as-taggable-on/issues/612#issuecomment-187419052","issue_url":"https://api.github.com/repos/mbleigh/acts-as-taggable-on/issues/612","id":187419052,"user":{"login":"pvbraga","id":7514121,"avatar_url":"https://avatars.githubusercontent.com/u/7514121?v=3","gravatar_id":"","url":"https://api.github.com/users/pvbraga","html_url":"https://github.com/pvbraga","followers_url":"https://api.github.com/users/pvbraga/followers","following_url":"https://api.github.com/users/pvbraga/following{/other_user}","gists_url":"https://api.github.com/users/pvbraga/gists{/gist_id}","starred_url":"https://api.github.com/users/pvbraga/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pvbraga/subscriptions","organizations_url":"https://api.github.com/users/pvbraga/orgs","repos_url":"https://api.github.com/users/pvbraga/repos","events_url":"https://api.github.com/users/pvbraga/events{/privacy}","received_events_url":"https://api.github.com/users/pvbraga/received_events","type":"User","site_admin":false},"created_at":"2016-02-22T22:33:48Z","updated_at":"2016-02-22T22:33:48Z","body":"I'm having this problem. Where do I put this piece of code?\r\n\r\n`ActsAsTaggableOn::Tag.find_each do |tag|\r\n  ActsAsTaggableOn::Tag.reset_counters(tag.id, :taggings)\r\nend`"}}