Open nynhex opened 7 years ago
to_prepare is deprecated in Rails 5.1. I'm sorry I don't have a solution, but this is why you are getting this error. This gem hasn't been updated in a bit.
@maynardewm No problem, I was able to write my own method to limit concurrent sessions in devise. Is there any room for maintainers? I'd love to help bring this gem up to date with rails 5.1
@nynhex How did you solve this issue? Can you post here your solution please? Thanks!
In case anyone has the same issue, this is what I did, till it gets upgraded to Rails 5.1.
In the console, at your application root:
To unpack the gem into lib/gems/
gem unpack devise_security_extension --target=lib/gems/
Edit with your an editor that has 'Replace All' functionality the following in gem folder:
'before_filter' to 'before_action'
'ActionDispatch::Callbacks.to_prepare' to 'ActiveSupport::Reloader.to_prepare'
Update your Gemfile.rb to point to the unpacked gem (make sure the name of the folder is correct):
gem 'devise_security_extension', :path => "lib/gems/devise_security_extension-0.9.2"
It should work fine then!
@MohamedBrary @nynhex I read the newest code, the deprecated was fixed. So, I just add the link to GitHub repo. Like below
gem 'devise_security_extension', git: 'https://github.com/phatworx/devise_security_extension.git'
Is It Okay? It works fine for me.
@MohamedBrary I don't think your solution will resolve the problem on production.
I think the code is running well in master branch. Why don't we release it to ruby gem?
@MohamedBrary, whomever you are, bless you!
The error appear when i use this gem with Rails 6.0.3.1. Please fix it.
Bundler could not find compatible versions for gem "railties": In snapshot (Gemfile.lock): railties (= 6.0.3.1)
In Gemfile: devise_security_extension was resolved to 0.10.0, which depends on railties (>= 3.2.6, < 6.0)
rails (~> 6.0.3.1) was resolved to 6.0.3.1, which depends on
railties (= 6.0.3.1)
Everyone above issue is fixed already. It can run with Rails 6.0.3 now. Thanks!
The most recent fix: https://github.com/phatworx/devise_security_extension/commit/bec97d5cbeee3a4554db2de8319daa2e51bf53ca#diff-ccd0262315867a38631692fd09ec4768a909c4e5a47fe81a58a21a5f1eb0922f
broke it for early rails versions (we are on 5.2.4.3)
Bundler could not find compatible versions for gem "railties":
In Gemfile:
devise_security_extension (~> 0.10.0) was resolved to 0.10.0, which depends on
railties (~> 6.0.3, >= 3.2.6)
rails (= 5.2.4.3) was resolved to 5.2.4.3, which depends on
railties (= 5.2.4.3)
@hoangth, Wouldn't just
s.add_runtime_dependency 'railties', '>= 3.2.6'
be enough for this use case?
@ntli239 Oh my god. That is my mistake. I'm so sorry. Then I have already made a new pull request to fix that error. https://github.com/phatworx/devise_security_extension/pull/250/files Now only wait for merging.
Any updates on that?
For the time being I have forked the repo and I am using my forked version. Seems to be working fine.
The devise_security_extension bundles fine, but the install command fails with the following stack trace.
Rails:
5.1
Ruby:2.4.1
rails generate devise_security_extension:install