Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rails 5.1 with latest gem using undefined method 'to_prepare' for ActionDispatch #407

Closed
mingersoll opened this issue May 1, 2017 · 12 comments

Comments

@mingersoll
Copy link

The gem package for shopify_app (7.2.6) doesn't include the latest merge request (#404) which fixes an issue with the session initializer.

I'm trying to generate the shopify app locally using the instuctions in the quickstart.mdb and am getting the error below. I'm using Rails 5.1.0 on Linux Mint 18.1

I'll try going back to Rails 5.0 but the gem should probably be updated to include the latest fixes.

Thanks!

rails generate shopify_app --api_key=MYKEY --secret=MYSECRET
/home/mike/test-app/config/initializers/shopify_session_repository.rb:4:in <top (required)>': **undefined method to_prepare' for ActionDispatch::Reloader:Class**
Did you mean? to_param (NoMethodError)
from /home/mike/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.0/lib/active_support/dependencies.rb:286:in load' from /home/mike/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.0/lib/active_support/dependencies.rb:286:in block in load'
from /home/mike/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.0/lib/active_support/dependencies.rb:258:in load_dependency' from /home/mike/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.0/lib/active_support/dependencies.rb:286:in load'
from /home/mike/.rvm/gems/ruby-2.4.1/gems/railties-5.1.0/lib/rails/engine.rb:655:in block in load_config_initializer' from /home/mike/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.0/lib/active_support/notifications.rb:168:in instrument'
from /home/mike/.rvm/gems/ruby-2.4.1/gems/railties-5.1.0/lib/rails/engine.rb:654:in load_config_initializer' from /home/mike/.rvm/gems/ruby-2.4.1/gems/railties-5.1.0/lib/rails/engine.rb:612:in block (2 levels) in class:Engine'
from /home/mike/.rvm/gems/ruby-2.4.1/gems/railties-5.1.0/lib/rails/engine.rb:611:in each' from /home/mike/.rvm/gems/ruby-2.4.1/gems/railties-5.1.0/lib/rails/engine.rb:611:in block in class:Engine'
from /home/mike/.rvm/gems/ruby-2.4.1/gems/railties-5.1.0/lib/rails/initializable.rb:30:in instance_exec' from /home/mike/.rvm/gems/ruby-2.4.1/gems/railties-5.1.0/lib/rails/initializable.rb:30:in run'
from /home/mike/.rvm/gems/ruby-2.4.1/gems/railties-5.1.0/lib/rails/initializable.rb:59:in block in run_initializers' from /home/mike/.rvm/rubies/ruby-2.4.1/lib/ruby/2.4.0/tsort.rb:228:in block in tsort_each'
from /home/mike/.rvm/rubies/ruby-2.4.1/lib/ruby/2.4.0/tsort.rb:350:in block (2 levels) in each_strongly_connected_component' from /home/mike/.rvm/rubies/ruby-2.4.1/lib/ruby/2.4.0/tsort.rb:422:in block (2 levels) in each_strongly_connected_component_from'
from /home/mike/.rvm/rubies/ruby-2.4.1/lib/ruby/2.4.0/tsort.rb:431:in each_strongly_connected_component_from' from /home/mike/.rvm/rubies/ruby-2.4.1/lib/ruby/2.4.0/tsort.rb:421:in block in each_strongly_connected_component_from'
from /home/mike/.rvm/gems/ruby-2.4.1/gems/railties-5.1.0/lib/rails/initializable.rb:48:in each' from /home/mike/.rvm/gems/ruby-2.4.1/gems/railties-5.1.0/lib/rails/initializable.rb:48:in tsort_each_child'
from /home/mike/.rvm/rubies/ruby-2.4.1/lib/ruby/2.4.0/tsort.rb:415:in call' from /home/mike/.rvm/rubies/ruby-2.4.1/lib/ruby/2.4.0/tsort.rb:415:in each_strongly_connected_component_from'
from /home/mike/.rvm/rubies/ruby-2.4.1/lib/ruby/2.4.0/tsort.rb:349:in block in each_strongly_connected_component' from /home/mike/.rvm/rubies/ruby-2.4.1/lib/ruby/2.4.0/tsort.rb:347:in each'
from /home/mike/.rvm/rubies/ruby-2.4.1/lib/ruby/2.4.0/tsort.rb:347:in call' from /home/mike/.rvm/rubies/ruby-2.4.1/lib/ruby/2.4.0/tsort.rb:347:in each_strongly_connected_component'
from /home/mike/.rvm/rubies/ruby-2.4.1/lib/ruby/2.4.0/tsort.rb:226:in tsort_each' from /home/mike/.rvm/rubies/ruby-2.4.1/lib/ruby/2.4.0/tsort.rb:205:in tsort_each'
from /home/mike/.rvm/gems/ruby-2.4.1/gems/railties-5.1.0/lib/rails/initializable.rb:58:in run_initializers' from /home/mike/.rvm/gems/ruby-2.4.1/gems/railties-5.1.0/lib/rails/application.rb:353:in initialize!'
from /home/mike/test-app/config/environment.rb:5:in <top (required)>' from /home/mike/.rvm/gems/ruby-2.4.1/gems/spring-2.0.1/lib/spring/application.rb:92:in require'
from /home/mike/.rvm/gems/ruby-2.4.1/gems/spring-2.0.1/lib/spring/application.rb:92:in preload' from /home/mike/.rvm/gems/ruby-2.4.1/gems/spring-2.0.1/lib/spring/application.rb:143:in serve'
from /home/mike/.rvm/gems/ruby-2.4.1/gems/spring-2.0.1/lib/spring/application.rb:131:in block in run' from /home/mike/.rvm/gems/ruby-2.4.1/gems/spring-2.0.1/lib/spring/application.rb:125:in loop'
from /home/mike/.rvm/gems/ruby-2.4.1/gems/spring-2.0.1/lib/spring/application.rb:125:in run' from /home/mike/.rvm/gems/ruby-2.4.1/gems/spring-2.0.1/lib/spring/application/boot.rb:19:in <top (required)>'
from /home/mike/.rvm/rubies/ruby-2.4.1/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in require' from /home/mike/.rvm/rubies/ruby-2.4.1/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in require'
from -e:1:in `

'

@mingersoll
Copy link
Author

I modified the gem locally with the changes suggested in the latest commit and my error went away, so updating the gem online should do the trick :D

@StraubCreative
Copy link

StraubCreative commented May 3, 2017

I'm getting the same error. Please clarify:

  • What gem and which version of that gem?
  • Which commit? The link listed below the comment above has commits that have failed tests, so what worked exactly?

I tried rolling back shopify_app, shopify_api, and rails gems, and also tried declaring last commit for shopify_app gem, like this:
gem 'shopify_app', :github => 'shopify/shopify_app', :branch => "package-for-release-7-2-7"

...but am getting the same error every time.

@mingersoll
Copy link
Author

mingersoll commented May 3, 2017

@StraubCreative I modified the shopify_app gem which is version 7.2.6. Its located in my .rvm folder (/home/mike/.rvm/gems/ruby-2.4.1/gems/shopify_app-7.2.6/lib/generators/shopify_app/shop_model/templates)

Sorry my last comment wasn't clear, the commit I was referring to was part of the merge request in my original comment. This merge request here: #404. In this merge request changes were made to the initializer template (lib/generators/shopify_app/shop_model/templates/shopify_session_repository.rb). I made the same change locally and stopped getting the error about the ActionDispatcher::Reloader.

My gem file for the shopify_app example includes these two lines and it works:
gem 'shopify_app', '~> 7.2', '>= 7.2.6'
gem 'activeresource', github: 'rails/activeresource', branch: 'master'

Hopefully this helps!

@StraubCreative
Copy link

@mingersoll it worked! Thanks for your help 👍

@coppermight
Copy link

@mingersoll @StraubCreative How exactly do i make these changes? Could you provide screenshots?

@mingersoll
Copy link
Author

mingersoll commented May 5, 2017

@Iam07 The Merge request that I linked too shows the commits that were made and the file changes. The files to update will be found in your .rvm folder . The GemFile will also be in there, just make sure the two lines I mention at the bottom of my post are in there.

@coppermight
Copy link

coppermight commented May 5, 2017

/Users/iam07/newmltagr/config/initializers/shopify_session_repository.rb:4:in <top (required)>': undefined method to_prepare' for ActionDispatch::Reloader:Class
Did you mean? to_param (NoMethodError)

This is the error that won't go away. Any help you can offer? @mingersoll

@mingersoll
Copy link
Author

@Iam07 Yes, the changes I made and included in this comment thread fix exactly that error.

@coppermight
Copy link

@mingersoll I'm a beginner so please bear with me. So, I changed the gem file using vim Gemfile and pasted the two lines you suggested. I then installed the bundle using bundle install and then tried to generate. Am i missing a step or where do you think i've gone wrong? Thanks in advance

@mingersoll
Copy link
Author

@Iam07 No worries, I'm also new to ruby. You missed the changes in the other files that I mentioned (the initializer template). Try a bundle update first before the install as well. This will update your gem lock file which is then used in your install. If you don't do the update I don't think the install will pull anything different. Part of being a beginner is trying lots of different things and failing until it works. Don't be afraid to fail!

@shashrao
Copy link

shashrao commented Jul 5, 2017

@mingersoll I'am using rails 5 and installed gem "activemessaging" and bundle install, but while using it gives class:Railtie': undefined method `to_prepare' for ActionDispatch::Callbacks:Class (NoMethodError)...the same gem was working fine in rails 4.x....

@imam-scs
Copy link

imam-scs commented Nov 5, 2018

I'am using rails 5.2.1 and installed gem "devise_google_authenticator" and bundle install, but while using it gives (Bundler::GemRequireError)
Gem Load Error is: undefined method `to_prepare' for ActionDispatch::Callbacks:Class
Bundler Error Backtrace:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants