# Will acts\_as\_taggable\_on\_steroids and better\_nested\_set work together?

**URL:** <https://www.ruby-forum.com/t/will-acts-as-taggable-on-steroids-and-better-nested-set-work-together/134957>\
**Category:** Rails\
**Created:** [April 16, 2008, 4:28pm UTC](https://www.ruby-forum.com/t/will-acts-as-taggable-on-steroids-and-better-nested-set-work-together/134957 "2008-04-16T16:28:26Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![apswartz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/71e660/32.png) [@apswartz](https://www.ruby-forum.com/u/apswartz)\
**Post date:** [April 16, 2008, 4:28pm UTC](https://www.ruby-forum.com/t/will-acts-as-taggable-on-steroids-and-better-nested-set-work-together/134957/1 "2008-04-16T16:28:26Z")

</div>

I am having this crazy problem where it ONLY shows up in testing.

This is my test code  
`
def test_should_destroy
task1 = Task.new(:description => “tmp”,
:done => false,
:user => User.find_by_login(‘admin’))
assert task1.save
assert task1.destroy
end
`

This is my task model  
`
class Task < ActiveRecord::Base
acts_as_taggable
acts_as_nested_set`

belongs\_to :user  
validates\_presence\_of :user  
end

The result of running the test:

1. Error:  
test\_should\_destroy(TaskTest):  
SystemStackError: stack level too deep  
/Users/alan/Projects/superb/vendor/plugins/acts\_as\_taggable\_on\_steroids/lib/acts\_as\_taggable.rb:220:in  
`reload_without_tag_list' /Users/alan/Projects/superb/vendor/plugins/acts_as_taggable_on_steroids/lib/acts_as_taggable.rb:220:in`reload’  
/Users/alan/Projects/superb/vendor/plugins/betternestedset/lib/better\_nested\_set.rb:161:in  
`before_destroy' /Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active_record/callbacks.rb:322:in`send’  
/Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active\_record/callbacks.rb:322:in  
`callback' /Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active_record/callbacks.rb:294:in`destroy\_without\_transactions’  
/Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active\_record/transactions.rb:104:in  
`destroy' /Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/database_statements.rb:66:in`transaction’  
/Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active\_record/transactions.rb:80:in  
`transaction' /Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active_record/transactions.rb:100:in`transaction’  
/Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active\_record/transactions.rb:104:in  
`destroy' ./test/unit/task_test.rb:37:in`test\_should\_destroy’  
/Library/Ruby/Gems/1.8/gems/activesupport-2.0.2/lib/active\_support/testing/default.rb:7:in  
`run’

If I comment out “acts\_as\_taggable”, then the test runs fine.

What is really driving me crazy is that in normal execution, the  
destroy works just fine.

ANY help or IDEAS would be GREATLY GREATLY GREATLY appreciated.

Thanks in advance,

Alan

---

<div class="post-metadata">

**Author:** ![apswartz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/71e660/32.png) [@apswartz](https://www.ruby-forum.com/u/apswartz)\
**Post date:** [April 16, 2008, 6:03pm UTC](https://www.ruby-forum.com/t/will-acts-as-taggable-on-steroids-and-better-nested-set-work-together/134957/2 "2008-04-16T18:03:00Z")

</div>

I found this: which is helping to unravel the puzzle:  
[http://rubyforge.org/pipermail/backgroundrb-devel/2008-February/001526.html](http://rubyforge.org/pipermail/backgroundrb-devel/2008-February/001526.html)

This was based off a problem in backgroundrb, but is EXACTLY what I am  
seeing when running tests. Any suggestions on how to make the  
similiar modifications that micha made to backgroundrb so that the  
tests will run?

Thanks in advance,

Alan

---

<div class="post-metadata">

**Author:** ![apswartz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/71e660/32.png) [@apswartz](https://www.ruby-forum.com/u/apswartz)\
**Post date:** [April 16, 2008, 6:10pm UTC](https://www.ruby-forum.com/t/will-acts-as-taggable-on-steroids-and-better-nested-set-work-together/134957/3 "2008-04-16T18:10:07Z")

</div>

On 16 Apr 2008, at 17:02, Alan S. wrote:

> I found this: which is helping to unravel the puzzle:  
> [http://rubyforge.org/pipermail/backgroundrb-devel/2008-February/001526.html](http://rubyforge.org/pipermail/backgroundrb-devel/2008-February/001526.html)
> 
> This was based off a problem in backgroundrb, but is EXACTLY what I am  
> seeing when running tests. Any suggestions on how to make the  
> similiar modifications that micha made to backgroundrb so that the  
> tests will run?

Similar but different. I bet that some where you are explicitly  
requiring your acts as taggable model (causing it to re-alias reload)

Fred

---

<div class="post-metadata">

**Author:** ![apswartz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/71e660/32.png) [@apswartz](https://www.ruby-forum.com/u/apswartz)\
**Post date:** [April 16, 2008, 6:35pm UTC](https://www.ruby-forum.com/t/will-acts-as-taggable-on-steroids-and-better-nested-set-work-together/134957/4 "2008-04-16T18:35:00Z")

</div>

Fred,  
Where would you look?

–Alan

On Wed, Apr 16, 2008 at 11:08 AM, Frederick C.

---

<div class="post-metadata">

**Author:** ![apswartz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/71e660/32.png) [@apswartz](https://www.ruby-forum.com/u/apswartz)\
**Post date:** [April 16, 2008, 6:46pm UTC](https://www.ruby-forum.com/t/will-acts-as-taggable-on-steroids-and-better-nested-set-work-together/134957/5 "2008-04-16T18:46:50Z")

</div>

On 16 Apr 2008, at 17:35, Frederick C. wrote:

> On 16 Apr 2008, at 17:34, Alan S. wrote:
> 
> > Fred,  
> > Where would you look?
> 
> Anywhere in the app.  
> And by that I mean absolutely anywhere - tests too.

---

<div class="post-metadata">

**Author:** ![apswartz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/71e660/32.png) [@apswartz](https://www.ruby-forum.com/u/apswartz)\
**Post date:** [April 16, 2008, 9:51pm UTC](https://www.ruby-forum.com/t/will-acts-as-taggable-on-steroids-and-better-nested-set-work-together/134957/6 "2008-04-16T21:51:43Z")

</div>

I don’t understand. It is part of the task model (as shown in the  
code in the first post.) This means that it would be included both in  
development and test environments. So why do I only have the problem  
in the test environment?

–Alan

On Wed, Apr 16, 2008 at 11:46 AM, Frederick C.

---

<div class="post-metadata">

**Author:** ![apswartz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/71e660/32.png) [@apswartz](https://www.ruby-forum.com/u/apswartz)\
**Post date:** [April 16, 2008, 10:54pm UTC](https://www.ruby-forum.com/t/will-acts-as-taggable-on-steroids-and-better-nested-set-work-together/134957/7 "2008-04-16T22:54:10Z")

</div>

On Apr 16, 7:09 pm, “Alan S.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I don’t understand. It is part of the task model (as shown in the  
> code in the first post.) This means that it would be included both in  
> development and test environments. So why do I only have the problem  
> in the test environment?

Well one possibility is that that the require happens from a test  
file, in which case it’s obvious why it only happens in test  
environment. The other is that in test you load all the models/tests  
in one go, whereas in development mode for any one action only those  
models/controllers that are used are loaded, and they are then  
unloaded: if the problem is 2 different files causing the task model  
to be loaded twice, then you might never see it in dev mode if any  
action would only require one of those actions to be loaded.

Fred

---

<div class="post-metadata">

**Author:** ![apswartz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/71e660/32.png) [@apswartz](https://www.ruby-forum.com/u/apswartz)\
**Post date:** [April 16, 2008, 6:36pm UTC](https://www.ruby-forum.com/t/will-acts-as-taggable-on-steroids-and-better-nested-set-work-together/134957/8 "2008-04-16T18:36:45Z")

</div>

On 16 Apr 2008, at 17:34, Alan S. wrote:

> Fred,  
> Where would you look?

Anywhere in the app.

---

<div class="post-metadata">

**Author:** ![apswartz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/71e660/32.png) [@apswartz](https://www.ruby-forum.com/u/apswartz)\
**Post date:** [April 16, 2008, 11:26pm UTC](https://www.ruby-forum.com/t/will-acts-as-taggable-on-steroids-and-better-nested-set-work-together/134957/9 "2008-04-16T23:26:04Z")

</div>

I FOUND IT!!! Thanks for your help. The problem…

I had “require tasks”.

Then I also had “fixtures :all”. The fixtures line caused the task  
to be required again.

–Alan

On Wed, Apr 16, 2008 at 1:47 PM, Frederick C.
