I can not use auto_migrations anymore, if paperclip is installed
Reported by Bence Nagy | April 15th, 2008 @ 02:26 AM
I do not know, which plugin causes the error, but if I remove paperclip from /vendor/plugins, auto-migrations works well again as before installing paperclip.
nagybence@localhost:~/rails/camper$ rake db:auto:migrate --trace
(in /home/nagybence/rails/camper)
** Invoke db:auto:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:auto:migrate
rake aborted!
stack level too deep
/home/nagybence/rails/camper/vendor/plugins/auto_migrations/lib/auto_migrations.rb:48:in `method_missing_without_auto_migration'
/home/nagybence/rails/camper/vendor/plugins/auto_migrations/lib/auto_migrations.rb:53:in `method_missing'
/home/nagybence/rails/camper/vendor/plugins/auto_migrations/lib/auto_migrations.rb:86:in `auto_create_table'
/home/nagybence/rails/camper/vendor/plugins/auto_migrations/lib/auto_migrations.rb:84:in `each'
/home/nagybence/rails/camper/vendor/plugins/auto_migrations/lib/auto_migrations.rb:84:in `auto_create_table'
/home/nagybence/rails/camper/vendor/plugins/auto_migrations/lib/auto_migrations.rb:49:in `method_missing'
/home/nagybence/rails/camper/db/schema.rb:3
/home/nagybence/rails/camper/vendor/plugins/auto_migrations/lib/auto_migrations.rb:7:in `instance_eval'
/home/nagybence/rails/camper/vendor/plugins/auto_migrations/lib/auto_migrations.rb:7:in `define'
/home/nagybence/rails/camper/db/schema.rb:1
/home/nagybence/rails/camper/vendor/rails/activesupport/lib/active_support/dependencies.rb:488:in `load'
/home/nagybence/rails/camper/vendor/rails/activesupport/lib/active_support/dependencies.rb:488:in `load'
/home/nagybence/rails/camper/vendor/rails/activesupport/lib/active_support/dependencies.rb:342:in `new_constants_in'
/home/nagybence/rails/camper/vendor/rails/activesupport/lib/active_support/dependencies.rb:488:in `load'
/home/nagybence/rails/camper/vendor/plugins/auto_migrations/lib/auto_migrations.rb:10:in `run'
/home/nagybence/rails/camper/vendor/plugins/auto_migrations/tasks/auto_migrations_tasks.rake:5
/usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:546:in `call'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:546:in `execute'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:541:in `each'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:541:in `execute'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:508:in `invoke_with_call_chain'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:501:in `synchronize'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:501:in `invoke_with_call_chain'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:494:in `invoke'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1931:in `invoke_task'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1909:in `top_level'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1909:in `each'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1909:in `top_level'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1948:in `standard_exception_handling'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1903:in `top_level'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1881:in `run'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1948:in `standard_exception_handling'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1878:in `run'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.1/bin/rake:31
/usr/bin/rake:19:in `load'
/usr/bin/rake:19
Comments and changes to this ticket
-
Jon Yurek April 15th, 2008 @ 05:39 PM
- → State changed from new to hold
- → Assigned user changed from to Jon Yurek
I've seen that error before. It was when I didn't check to see if a method was already alias_method_chained. As far as I can tell that means auto_migrations is being included twice for some reason. I know Paperclip doesn't have any dependency on it, so I don't know why it would be added twice.
However, the fix would be to change the following line in auto_migration's lib/auto_migration.rb (line 40 as near as I can tell from the only copy of the source I can find)...
alias_method_chain :method_missing, :auto_migration
... to ...
alias_method_chain :method_missing, :auto_migration unless instance_methods.include?('method_missing_without_auto_migration')
... which will protect the method from being chained twice.
If that works, let me know. Thanks.
-

-
-
Stefano C. April 18th, 2008 @ 05:37 AM
The culprit is the first line in paperclips's rake file (tasks/paperclip_tasks.rake). There's no need to require "environment" (at this point the application environment is already loaded and configured), and simply removing the line solves the problem with auto_migrations (and possibly other libraries/plugins that use method chaining) without requiring any patching.
Please Login or create a free account to add a new comment.
You can update this ticket by sending an email to from your email client. (help)
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
