winton / acts_as_archive

Don't delete your records, move them to a different table
MIT License
372 stars 87 forks source link

Stack level too deep #17

Closed ndelage closed 13 years ago

ndelage commented 13 years ago

rails (2.3.10) acts_as_archive (0.3.2) also_migrate (0.3.2)

Creating a sample project with acts_as_archive as a required gem caused migrations to fail with a "stack level too deep" error message.

To reproduce:

$ rails archive_test
$ cd archive_test
$ ruby script/generate migration user name:string
$ rake db:migrate (works!)

Now add acts_as_archive as a required gem to config/environment.rb

$ rake db:drop
$ rake db:migrate --trace
(in projects/archive_test)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
rake aborted!
stack level too deep
/Library/Ruby/Gems/1.8/gems/also_migrate-0.3.2/lib/also_migrate/migrator.rb:29:in `migrate_without_also_migrate'
/Library/Ruby/Gems/1.8/gems/also_migrate-0.3.2/lib/also_migrate/migrator.rb:29:in `migrate'
/Library/Ruby/Gems/1.8/gems/activerecord-2.3.10/lib/active_record/migration.rb:401:in `up'
/Library/Ruby/Gems/1.8/gems/activerecord-2.3.10/lib/active_record/migration.rb:383:in `migrate'
/Library/Ruby/Gems/1.8/gems/rails-2.3.10/lib/tasks/databases.rake:112
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/bin/rake:31
/usr/bin/rake:19:in `load'
/usr/bin/rake:19
ndelage commented 13 years ago

Tested a bit more and it appears you need to add acts_as_archive to every single model or you'll receive the stack level too deep error.

A quick fix might be to mention this requirement in the documentation. I had originally planned to only use acts_as_archvied on some of my models (on my production application). Seems I'll have to use it for every single model.

ndelage commented 13 years ago

Can't seem to reproduce my earlier success with act_as_archive added to each AR model class.

So for me, this is an open issue. I can't get acts_as_archive to work at all locally.

winton commented 13 years ago

Thank you so much for your very clear explanation of how to reproduce this. If only all descriptions were this good.

You'll be happy to know that your problem is fixed with the latest release (0.3.4).

ndelage commented 13 years ago

Thanks so much for the quick fix!