stffn / declarative_authorization

An unmaintained authorization plugin for Rails. Please fork to support current versions of Rails
MIT License
1.24k stars 233 forks source link

Undefined method `hide_action` - using Rails 5 #221

Open tomkadwill opened 7 years ago

tomkadwill commented 7 years ago

I'm using Rails 5. After I install the gem and run rails g authorization:install I get the following error:

/Users/blahblah/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.13.7/lib/bundler/runtime.rb:94:in `rescue in block (2 levels) in require': There was an error while trying to load the gem 'declarative_authorization'.
Gem Load Error is: undefined method `hide_action' for ActionController::Base:Class
Backtrace for gem load error is:
/Users/blahblah/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/declarative_authorization-0.5.7/lib/declarative_authorization/in_controller.rb:9:in `included'
/Users/blahblah/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/declarative_authorization-0.5.7/lib/declarative_authorization.rb:16:in `include'
/Users/blahblah/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/declarative_authorization-0.5.7/lib/declarative_authorization.rb:16:in `<top (required)>'
/Users/blahblah/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.13.7/lib/bundler/runtime.rb:91:in `require'
/Users/blahblah/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.13.7/lib/bundler/runtime.rb:91:in `block (2 levels) in require'
/Users/blahblah/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.13.7/lib/bundler/runtime.rb:86:in `each'
/Users/blahblah/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.13.7/lib/bundler/runtime.rb:86:in `block in require'
/Users/blahblah/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.13.7/lib/bundler/runtime.rb:75:in `each'
/Users/blahblah/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.13.7/lib/bundler/runtime.rb:75:in `require'
/Users/blahblah/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.13.7/lib/bundler.rb:106:in `require'

Let me know if this is something that the maintainers want to fix - I would be happy to help with this.

zeiv commented 7 years ago

Hey @tomkadwill, if you're interested, I've been working on a gem designed to be a drop-in Rails 5 replacement for Declarative Authorization called Authoreyes. It uses the exact same authorization rules DSL syntax. I'm using it comfortably in a production/professional app right now despite the warnings in the README (which probably should be updated).

I'm not sure how the rest of the community feels about it, but I would love to have some Decl Auth users try it out and provide feedback or contributions.

tomkadwill commented 7 years ago

Thanks @zeiv, I'll give it a try :)

dvicory commented 5 years ago

@tomkadwill I know it's been awhile, but for you or people in the future who find this, I'd recommend our fork of declarative_authorization. ae_declarative_authorization adds Rails 5 support, among many other improvements, and we're actively maintaining it since it's a huge part of our app.

dabizlja commented 4 years ago

our

@dvicory is there any documentation for upgrading from declarative_authorization to your fork? Or everything will continue to work the same there is nothing specific to be changed/added after switching over to your fork? Thanks

dvicory commented 4 years ago

@dvicory is there any documentation for upgrading from declarative_authorization to your fork? Or everything will continue to work the same there is nothing specific to be changed/added after switching over to your fork? Thanks

@Dabizlja, there's no explicit documentation on how to do it. What I can say is our internal change from our monkey patched declarative_authorization (mostly optimizations) to ae_declarative_authorization was very easy. ae_declarative_authorization started life from another person's fork of this repo, then we applied our optimization monkey patches. Even with all that history to the gem, we still didn't have to make changes beyond switching requires and the dependency.

Since the first release, we've continued to add support for more things like Rails 6 and Grape. I know each of these changes were done with an eye towards backwards compatibility to minimize our internal burden of upgrading since we use it extensively. I don't think I can guarantee drop-in compatibility for later releases, but I find it likely the upgrade would be painless and likely consist of simply changing the dependency and perhaps a few requires, as the major API surface shouldn't have changed.

One big thing I know we included was the removal of the rules browser (looking at the old issue now it seems it may have not worked anyway).

Please try it out and if there's something interesting about your upgrade process, please do let us know with a new issue in ae_declarative_authorization so that we could add or fix documentation.