phatworx / devise_security_extension

An enterprise security extension for devise, trying to meet industrial standard security demands for web applications.
MIT License
747 stars 346 forks source link

Error on Rails 5.1.2 #222

Closed maengkom closed 7 years ago

maengkom commented 7 years ago

Add to gemfile, then bundle install. After that just type rails generate devise_security_extension:install raise this error.

/Users/tester/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/bundler-1.15.1/lib/bundler/runtime.rb:85:in `rescue in block (2 levels) in require': There was an error while trying to load the gem 'devise_security_extension'.
Gem Load Error is: undefined method `to_prepare' for ActionDispatch::Callbacks:Class
Did you mean?  to_param
Backtrace for gem load error is:
/Users/tester/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/devise_security_extension-0.9.2/lib/devise_security_extension/rails.rb:7:in `<class:Engine>'
/Users/tester/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/devise_security_extension-0.9.2/lib/devise_security_extension/rails.rb:2:in `<module:DeviseSecurityExtension>'
/Users/tester/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/devise_security_extension-0.9.2/lib/devise_security_extension/rails.rb:1:in `<top (required)>'
/Users/tester/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activesupport-5.1.2/lib/active_support/dependencies.rb:292:in `require'
/Users/tester/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activesupport-5.1.2/lib/active_support/dependencies.rb:292:in `block in require'
/Users/tester/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activesupport-5.1.2/lib/active_support/dependencies.rb:258:in `load_dependency'
/Users/tester/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activesupport-5.1.2/lib/active_support/dependencies.rb:292:in `require'
/Users/tester/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/devise_security_extension-0.9.2/lib/devise_security_extension.rb:92:in `<top (required)>'
/Users/tester/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/bundler-1.15.1/lib/bundler/runtime.rb:82:in `require'
/Users/tester/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/bundler-1.15.1/lib/bundler/runtime.rb:82:in `block (2 levels) in require'
/Users/tester/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/bundler-1.15.1/lib/bundler/runtime.rb:77:in `each'
/Users/tester/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/bundler-1.15.1/lib/bundler/runtime.rb:77:in `block in require'
/Users/tester/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/bundler-1.15.1/lib/bundler/runtime.rb:66:in `each'
/Users/tester/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/bundler-1.15.1/lib/bundler/runtime.rb:66:in `require'
/Users/tester/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/bundler-1.15.1/lib/bundler.rb:108:in `require'
/Users/tester/Code/Turboly/turboly-fleet/config/application.rb:17:in `<top (required)>'
/Users/tester/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/application.rb:92:in `require'
/Users/tester/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/application.rb:92:in `preload'
/Users/tester/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/application.rb:153:in `serve'
/Users/tester/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/application.rb:141:in `block in run'
/Users/tester/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/application.rb:135:in `loop'
/Users/tester/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/application.rb:135:in `run'
/Users/tester/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/application/boot.rb:19:in `<top (required)>'
/Users/tester/.rbenv/versions/2.4.1/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/Users/tester/.rbenv/versions/2.4.1/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
-e:1:in `<main>'
Bundler Error Backtrace:
 (Bundler::GemRequireError)
  from /Users/tester/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/bundler-1.15.1/lib/bundler/runtime.rb:81:in `block (2 levels) in require'
  from /Users/tester/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/bundler-1.15.1/lib/bundler/runtime.rb:77:in `each'
  from /Users/tester/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/bundler-1.15.1/lib/bundler/runtime.rb:77:in `block in require'
  from /Users/tester/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/bundler-1.15.1/lib/bundler/runtime.rb:66:in `each'
  from /Users/tester/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/bundler-1.15.1/lib/bundler/runtime.rb:66:in `require'
  from /Users/tester/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/bundler-1.15.1/lib/bundler.rb:108:in `require'
  from /Users/tester/Code/Turboly/turboly-fleet/config/application.rb:17:in `<top (required)>'
  from /Users/tester/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/application.rb:92:in `require'
  from /Users/tester/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/application.rb:92:in `preload'
  from /Users/tester/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/application.rb:153:in `serve'
  from /Users/tester/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/application.rb:141:in `block in run'
  from /Users/tester/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/application.rb:135:in `loop'
  from /Users/tester/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/application.rb:135:in `run'
  from /Users/tester/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/application/boot.rb:19:in `<top (required)>'
  from /Users/tester/.rbenv/versions/2.4.1/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
  from /Users/tester/.rbenv/versions/2.4.1/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
  from -e:1:in `<main>'
jdarnok commented 7 years ago

Hey @maengkom. This is warning from the 5.0: DEPRECATION WARNING: to_prepare is deprecated and will be removed from Rails 5.1 (use ActiveSupport::Reloader.to_prepare instead)

maengkom commented 7 years ago

@jdarnok thanks for reply, what should I do ? sorry just couple months using rails. I have to fork and modify it correct ? and where is it ?

Thanks.

jdarnok commented 7 years ago

@maengkom if you really want that feature without sweat, just revert to rails 5.0 - it's not desirable solution, but maybe (MAYBE) someone will patch that gem. If you want to fork, you must change all 'to_prepare' statements or wait for the fix. Unfortunately I don't have time for making those fixes ATM, and to be honest I don't know the project's codebase so I can't help you with that.

jdarnok commented 7 years ago

@maengkom Check some pull requests though https://github.com/phatworx/devise_security_extension/pull/188

maengkom commented 7 years ago

@jdarnok yes thanks for the link. I'll try to read the PR code.

MohamedBrary commented 7 years ago

@maengkom Here is what I did for this issue, till the gem gets updated to Rails 5.1

https://github.com/phatworx/devise_security_extension/issues/223#issuecomment-317129505

narutoo9x commented 7 years ago

@maengkom upgrade the gem to lastest version will fix it.

gem 'devise_security_extension', git: 'https://github.com/phatworx/devise_security_extension.git'
maengkom commented 7 years ago

@narutoo9x oh yeah I never reference to git directly, it works. Thanks. @MohamedBrary thank you for the tip.