{"action":"created","issue":{"url":"https://api.github.com/repos/swanandp/acts_as_list/issues/199","repository_url":"https://api.github.com/repos/swanandp/acts_as_list","labels_url":"https://api.github.com/repos/swanandp/acts_as_list/issues/199/labels{/name}","comments_url":"https://api.github.com/repos/swanandp/acts_as_list/issues/199/comments","events_url":"https://api.github.com/repos/swanandp/acts_as_list/issues/199/events","html_url":"https://github.com/swanandp/acts_as_list/issues/199","id":148622402,"number":199,"title":"Undefined instance variable @scope_changed since 0.7.3","user":{"login":"gamecreature","id":577933,"avatar_url":"https://avatars.githubusercontent.com/u/577933?v=3","gravatar_id":"","url":"https://api.github.com/users/gamecreature","html_url":"https://github.com/gamecreature","followers_url":"https://api.github.com/users/gamecreature/followers","following_url":"https://api.github.com/users/gamecreature/following{/other_user}","gists_url":"https://api.github.com/users/gamecreature/gists{/gist_id}","starred_url":"https://api.github.com/users/gamecreature/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gamecreature/subscriptions","organizations_url":"https://api.github.com/users/gamecreature/orgs","repos_url":"https://api.github.com/users/gamecreature/repos","events_url":"https://api.github.com/users/gamecreature/events{/privacy}","received_events_url":"https://api.github.com/users/gamecreature/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-04-15T10:25:54Z","updated_at":"2016-04-15T11:13:01Z","closed_at":null,"body":"I'm using spree which combines acts_as_list and awesome_nested_set set.\r\n\r\nWith 0.7.2 everything works perfectly\r\nWith version 0.7.3 the error below happens. After some painful debugging I noticed @scope_changed was coming from acts_as_list. Reverting acts_as_list to the 0.7.2 versions fixes it.\r\n\r\nI assume the reason is there isn't an instance_variable @scope_changed when the record is committed. \r\n\r\nSo I guess the line of commit (5cba2f292feca6f7f54209b48ff57077ad1dbbcf)\r\n```\r\nafter_save '@scope_changed = false'\r\n```\r\nwas pretty important, for defining this variable?\r\n\r\n```\r\nNameError: instance variable @scope_changed not defined\r\n(eval):1:in `remove_instance_variable'\r\n(eval):1:in `block in make_lambda'\r\n/var/lib/gems/2.2.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:435:in `instance_exec'\r\n/var/lib/gems/2.2.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:435:in `block in make_lambda'\r\n/var/lib/gems/2.2.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:263:in `call'\r\n/var/lib/gems/2.2.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:263:in `block in simple'\r\n/var/lib/gems/2.2.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:506:in `call'\r\n/var/lib/gems/2.2.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:506:in `block in call'\r\n/var/lib/gems/2.2.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:506:in `each'\r\n/var/lib/gems/2.2.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:506:in `call'\r\n/var/lib/gems/2.2.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:92:in `__run_callbacks__'\r\n/var/lib/gems/2.2.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:778:in `_run_commit_callbacks'\r\n/var/lib/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/transactions.rb:314:in `committed!'\r\n/var/lib/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/transaction.rb:89:in `commit_records'\r\n/var/lib/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/transaction.rb:153:in `commit'\r\n/var/lib/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/transaction.rb:175:in `commit_transaction'\r\n/var/lib/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/transaction.rb:194:in `within_new_transaction'\r\n/var/lib/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction'\r\n/var/lib/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/transactions.rb:220:in `transaction'\r\n/var/lib/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/transactions.rb:348:in `with_transaction_returning_status'\r\n/var/lib/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/transactions.rb:291:in `save!'\r\n/var/lib/gems/2.2.0/gems/awesome_nested_set-3.0.3/lib/awesome_nested_set/tree.rb:41:in `set_left_and_rights'\r\n/var/lib/gems/2.2.0/gems/awesome_nested_set-3.0.3/lib/awesome_nested_set/tree.rb:38:in `block in set_left_and_rights'\r\n/var/lib/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/relation/delegation.rb:46:in `each'\r\n/var/lib/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/relation/delegation.rb:46:in `each'\r\n/var/lib/gems/2.2.0/gems/awesome_nested_set-3.0.3/lib/awesome_nested_set/tree.rb:38:in `set_left_and_rights'\r\n/var/lib/gems/2.2.0/gems/awesome_nested_set-3.0.3/lib/awesome_nested_set/tree.rb:38:in `block in set_left_and_rights'\r\n/var/lib/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/relation/delegation.rb:46:in `each'\r\n/var/lib/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/relation/delegation.rb:46:in `each'\r\n/var/lib/gems/2.2.0/gems/awesome_nested_set-3.0.3/lib/awesome_nested_set/tree.rb:38:in `set_left_and_rights'\r\n/var/lib/gems/2.2.0/gems/awesome_nested_set-3.0.3/lib/awesome_nested_set/tree.rb:25:in `block in rebuild!'\r\n/var/lib/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/relation/delegation.rb:46:in `each'\r\n/var/lib/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/relation/delegation.rb:46:in `each'\r\n/var/lib/gems/2.2.0/gems/awesome_nested_set-3.0.3/lib/awesome_nested_set/tree.rb:22:in `rebuild!'\r\n/var/lib/gems/2.2.0/gems/awesome_nested_set-3.0.3/lib/awesome_nested_set/model/rebuildable.rb:15:in `block in rebuild!'\r\n/var/lib/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/scoping/default.rb:33:in `block in unscoped'\r\n/var/lib/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/relation.rb:302:in `scoping'\r\n/var/lib/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/scoping/default.rb:33:in `unscoped'\r\n/var/lib/gems/2.2.0/gems/awesome_nested_set-3.0.3/lib/awesome_nested_set/model/rebuildable.rb:14:in `rebuild!'\r\nTasks: TOP => bp:cron\r\n```"},"comment":{"url":"https://api.github.com/repos/swanandp/acts_as_list/issues/comments/210419610","html_url":"https://github.com/swanandp/acts_as_list/issues/199#issuecomment-210419610","issue_url":"https://api.github.com/repos/swanandp/acts_as_list/issues/199","id":210419610,"user":{"login":"brendon","id":81871,"avatar_url":"https://avatars.githubusercontent.com/u/81871?v=3","gravatar_id":"","url":"https://api.github.com/users/brendon","html_url":"https://github.com/brendon","followers_url":"https://api.github.com/users/brendon/followers","following_url":"https://api.github.com/users/brendon/following{/other_user}","gists_url":"https://api.github.com/users/brendon/gists{/gist_id}","starred_url":"https://api.github.com/users/brendon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brendon/subscriptions","organizations_url":"https://api.github.com/users/brendon/orgs","repos_url":"https://api.github.com/users/brendon/repos","events_url":"https://api.github.com/users/brendon/events{/privacy}","received_events_url":"https://api.github.com/users/brendon/received_events","type":"User","site_admin":false},"created_at":"2016-04-15T11:13:01Z","updated_at":"2016-04-15T11:13:01Z","body":"Hi there, so sorry to see that caused a bug. I don't think it's that line, rather, we're not checking for the existence of the instance variable before trying to remove it.\r\n\r\nHow about this as a solution?\r\n\r\n```ruby\r\nafter_commit 'remove_instance_variable(:@scope_changed) if defined?(@scope_changed)'\r\n```\r\n\r\nTry bundling this branch and see if that fixes the problem. The tests probably didn't pick this up because the tests all trigger the creation of the variable."}}