Will acts_as_taggable_on_steroids and better_nested_set work together?

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:inreload’
    /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:insend’
    /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:indestroy_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:intransaction’
    /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:intransaction’
    /Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active_record/transactions.rb:104:in
    destroy' ./test/unit/task_test.rb:37:intest_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

I found this: which is helping to unravel the puzzle:
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

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

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

Fred,
Where would you look?

–Alan

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

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.

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.

On Apr 16, 7:09 pm, “Alan S.” [email protected] 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

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

Fred,
Where would you look?

Anywhere in the app.

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.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs