Just came across a perculiar problem that took a while to figure out so I thought I should document it for prosperity.
Situation was that I was trying to do a capistrano deploy using the shopify-app gem and was getting an error: NoMethodError: super: no superclass method `require' for main:Object.
The stack trace looked like this:
* executing "cd /home/sva/app/releases/20140712202310 && bundle exec rake RAILS_ENV=production db:migrate" servers: ["**.**.**.163"] [**.**.**.163] executing command ** [out :: **.**.**.163] rake aborted! ** [out :: **.**.**.163] NoMethodError: super: no superclass method `require' for main:Object ** [out :: **.**.**.163] /home/sva/app/shared/bundle/ruby/1.8/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:251:in `require' ** [out :: **.**.**.163] /home/sva/app/shared/bundle/ruby/1.8/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:236:in `load_dependency' ** [out :: **.**.**.163] /home/sva/app/shared/bundle/ruby/1.8/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:251:in `require' ** [out :: **.**.**.163] /home/sva/app/shared/bundle/ruby/1.8/gems/activesupport-3.2.19/lib/active_support/core_ext/module/attribute_accessors.rb:35:in `to_proc' ** [out :: **.**.**.163] /home/sva/app/shared/bundle/ruby/1.8/gems/shopify_api-3.0.3/lib/shopify_api/resources.rb:2:in `glob' ** [out :: **.**.**.163] /home/sva/app/shared/bundle/ruby/1.8/gems/shopify_api-3.0.3/lib/shopify_api/resources.rb:2 ** [out :: **.**.**.163] /home/sva/app/shared/bundle/ruby/1.8/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:251:in `require' ** [out :: **.**.**.163] /home/sva/app/shared/bundle/ruby/1.8/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:251:in `require' ** [out :: **.**.**.163] /home/sva/app/shared/bundle/ruby/1.8/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:236:in `load_dependency' ** [out :: **.**.**.163] /home/sva/app/shared/bundle/ruby/1.8/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:251:in `require' ** [out :: **.**.**.163] /home/sva/app/shared/bundle/ruby/1.8/gems/shopify_api-3.0.3/lib/shopify_api.rb:22 ** [out :: **.**.**.163] /home/sva/app/shared/bundle/ruby/1.8/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:251:in `require' ** [out :: **.**.**.163] /home/sva/app/shared/bundle/ruby/1.8/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:251:in `require' ** [out :: **.**.**.163] /home/sva/app/shared/bundle/ruby/1.8/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:236:in `load_dependency' ** [out :: **.**.**.163] /home/sva/app/shared/bundle/ruby/1.8/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:251:in `require' ** [out :: **.**.**.163] /home/sva/app/shared/bundle/ruby/1.8/gems/shopify_app-3.0.4/lib/shopify_app.rb:1 ** [out :: **.**.**.163] /home/sva/app/releases/20140712202310/config/application.rb:7 ** [out :: **.**.**.163] /home/sva/app/releases/20140712202310/Rakefile:5:in `require' ** [out :: **.**.**.163] /home/sva/app/releases/20140712202310/Rakefile:5 ** [out :: **.**.**.163] (See full trace by running task with --trace)
The fix turned out to be simple, but unfortunately I don't know exactly how it fixed it. I moved the location of the shopify-app gem to just after where rails was defined. I suspect this had something to do with monkey patching.
The working (truncated) Gemfile looks like this:
source 'http://rubygems.org' gem 'rails', '~> 3.2.0' gem 'shopify_app', '~> 3.0.4' # ruby 1.8.7 compatible ...
If anyone can shed some more light on why moving it higher up fixes it please let me know via the comments.
Comments
You can follow this conversation by subscribing to the comment feed for this post.