Open bark-barry opened 4 years ago
Hi! Could you send to us the whole stack trace please?
It would also be useful to know:
/Users/barrybrinkley/.gem/ruby/2.4.6/gems/activerecord-5.1.7/lib/active_record/dynamic_matchers.rb:22:in `method_missing': undefined method `cache_versioning=' for Authz::ApplicationRecord(abstract):Class (NoMethodError) from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/authz-0.0.4/app/models/authz/application_record.rb:11:in `<class:ApplicationRecord>' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/authz-0.0.4/app/models/authz/application_record.rb:4:in `<module:Authz>' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/authz-0.0.4/app/models/authz/application_record.rb:1:in `<top (required)>' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/activesupport-5.1.7/lib/active_support/dependencies.rb:477:in `load' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/activesupport-5.1.7/lib/active_support/dependencies.rb:477:in `block in load_file' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/activesupport-5.1.7/lib/active_support/dependencies.rb:662:in `new_constants_in' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/activesupport-5.1.7/lib/active_support/dependencies.rb:476:in `load_file' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/activesupport-5.1.7/lib/active_support/dependencies.rb:374:in `block in require_or_load' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/activesupport-5.1.7/lib/active_support/dependencies.rb:36:in `block in load_interlock' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/activesupport-5.1.7/lib/active_support/dependencies/interlock.rb:12:in `block in loading' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/activesupport-5.1.7/lib/active_support/concurrency/share_lock.rb:149:in `exclusive' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/activesupport-5.1.7/lib/active_support/dependencies/interlock.rb:11:in `loading' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/activesupport-5.1.7/lib/active_support/dependencies.rb:36:in `load_interlock' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/activesupport-5.1.7/lib/active_support/dependencies.rb:357:in `require_or_load' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/activesupport-5.1.7/lib/active_support/dependencies.rb:511:in `load_missing_constant' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/activesupport-5.1.7/lib/active_support/dependencies.rb:202:in `const_missing' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/authz-0.0.4/app/models/authz/role.rb:3:in `<module:Authz>' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/authz-0.0.4/app/models/authz/role.rb:1:in `<top (required)>' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/activesupport-5.1.7/lib/active_support/dependencies.rb:477:in `load' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/activesupport-5.1.7/lib/active_support/dependencies.rb:477:in `block in load_file' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/activesupport-5.1.7/lib/active_support/dependencies.rb:662:in `new_constants_in' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/activesupport-5.1.7/lib/active_support/dependencies.rb:476:in `load_file' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/activesupport-5.1.7/lib/active_support/dependencies.rb:374:in `block in require_or_load' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/activesupport-5.1.7/lib/active_support/dependencies.rb:36:in `block in load_interlock' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/activesupport-5.1.7/lib/active_support/dependencies/interlock.rb:12:in `block in loading' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/activesupport-5.1.7/lib/active_support/concurrency/share_lock.rb:149:in `exclusive' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/activesupport-5.1.7/lib/active_support/dependencies/interlock.rb:11:in `loading' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/activesupport-5.1.7/lib/active_support/dependencies.rb:36:in `load_interlock' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/activesupport-5.1.7/lib/active_support/dependencies.rb:357:in `require_or_load' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/activesupport-5.1.7/lib/active_support/dependencies.rb:511:in `load_missing_constant' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/activesupport-5.1.7/lib/active_support/dependencies.rb:202:in `const_missing' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/authz-0.0.4/lib/authz/models/rolable.rb:23:in `block in <module:Rolable>' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/activesupport-5.1.7/lib/active_support/concern.rb:120:in `class_eval' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/activesupport-5.1.7/lib/active_support/concern.rb:120:in `append_features' from /Users/barrybrinkley/code/bark/barkbox-rails/app/models/user.rb:54:in `include' from /Users/barrybrinkley/code/bark/barkbox-rails/app/models/user.rb:54:in `<class:User>' from /Users/barrybrinkley/code/bark/barkbox-rails/app/models/user.rb:38:in `<top (required)>' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/activesupport-5.1.7/lib/active_support/dependencies.rb:477:in `load' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/activesupport-5.1.7/lib/active_support/dependencies.rb:477:in `block in load_file' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/activesupport-5.1.7/lib/active_support/dependencies.rb:662:in `new_constants_in' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/activesupport-5.1.7/lib/active_support/dependencies.rb:476:in `load_file' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/activesupport-5.1.7/lib/active_support/dependencies.rb:374:in `block in require_or_load' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/activesupport-5.1.7/lib/active_support/dependencies.rb:36:in `block in load_interlock' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/activesupport-5.1.7/lib/active_support/dependencies/interlock.rb:12:in `block in loading' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/activesupport-5.1.7/lib/active_support/concurrency/share_lock.rb:149:in `exclusive' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/activesupport-5.1.7/lib/active_support/dependencies/interlock.rb:11:in `loading' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/activesupport-5.1.7/lib/active_support/dependencies.rb:36:in `load_interlock' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/activesupport-5.1.7/lib/active_support/dependencies.rb:357:in `require_or_load' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/activesupport-5.1.7/lib/active_support/dependencies.rb:511:in `load_missing_constant' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/activesupport-5.1.7/lib/active_support/dependencies.rb:202:in `const_missing' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/activesupport-5.1.7/lib/active_support/inflector/methods.rb:269:in `const_get' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/activesupport-5.1.7/lib/active_support/inflector/methods.rb:269:in `block in constantize' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/activesupport-5.1.7/lib/active_support/inflector/methods.rb:267:in `each' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/activesupport-5.1.7/lib/active_support/inflector/methods.rb:267:in `inject' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/activesupport-5.1.7/lib/active_support/inflector/methods.rb:267:in `constantize' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/activesupport-5.1.7/lib/active_support/core_ext/string/inflections.rb:66:in `constantize' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/activesupport-5.1.7/lib/active_support/core_ext/object/try.rb:17:in `public_send' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/activesupport-5.1.7/lib/active_support/core_ext/object/try.rb:17:in `try!' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/activesupport-5.1.7/lib/active_support/core_ext/object/try.rb:6:in `try' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/rails-observers-0.1.5/lib/rails/observers/active_model/observing.rb:334:in `observed_class' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/rails-observers-0.1.5/lib/rails/observers/active_model/observing.rb:325:in `observed_classes' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/rails-observers-0.1.5/lib/rails/observers/active_model/observing.rb:345:in `observed_classes' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/rails-observers-0.1.5/lib/rails/observers/activerecord/observer.rb:100:in `observed_classes' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/rails-observers-0.1.5/lib/rails/observers/active_model/observing.rb:341:in `initialize' from /Users/barrybrinkley/.rubies/ruby-2.4.6/lib/ruby/2.4.0/singleton.rb:142:in `new' from /Users/barrybrinkley/.rubies/ruby-2.4.6/lib/ruby/2.4.0/singleton.rb:142:in `block in instance' from /Users/barrybrinkley/.rubies/ruby-2.4.6/lib/ruby/2.4.0/singleton.rb:140:in `synchronize' from /Users/barrybrinkley/.rubies/ruby-2.4.6/lib/ruby/2.4.0/singleton.rb:140:in `instance' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/rails-observers-0.1.5/lib/rails/observers/active_model/observing.rb:186:in `instantiate_observer' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/rails-observers-0.1.5/lib/rails/observers/active_model/observing.rb:108:in `block in instantiate_observers' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/rails-observers-0.1.5/lib/rails/observers/active_model/observing.rb:108:in `each' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/rails-observers-0.1.5/lib/rails/observers/active_model/observing.rb:108:in `instantiate_observers' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/rails-observers-0.1.5/lib/rails/observers/railtie.rb:42:in `block (2 levels) in <class:Railtie>' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/activesupport-5.1.7/lib/active_support/lazy_load_hooks.rb:69:in `instance_eval' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/activesupport-5.1.7/lib/active_support/lazy_load_hooks.rb:69:in `block in execute_hook' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/activesupport-5.1.7/lib/active_support/lazy_load_hooks.rb:60:in `with_execution_control' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/activesupport-5.1.7/lib/active_support/lazy_load_hooks.rb:65:in `execute_hook' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/activesupport-5.1.7/lib/active_support/lazy_load_hooks.rb:41:in `block in on_load' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/activesupport-5.1.7/lib/active_support/lazy_load_hooks.rb:40:in `each' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/activesupport-5.1.7/lib/active_support/lazy_load_hooks.rb:40:in `on_load' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/rails-observers-0.1.5/lib/rails/observers/railtie.rb:41:in `block in <class:Railtie>' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/activesupport-5.1.7/lib/active_support/lazy_load_hooks.rb:67:in `block in execute_hook' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/activesupport-5.1.7/lib/active_support/lazy_load_hooks.rb:60:in `with_execution_control' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/activesupport-5.1.7/lib/active_support/lazy_load_hooks.rb:65:in `execute_hook' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/activesupport-5.1.7/lib/active_support/lazy_load_hooks.rb:50:in `block in run_load_hooks' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/activesupport-5.1.7/lib/active_support/lazy_load_hooks.rb:49:in `each' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/activesupport-5.1.7/lib/active_support/lazy_load_hooks.rb:49:in `run_load_hooks' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/railties-5.1.7/lib/rails/application/finisher.rb:73:in `block in <module:Finisher>' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/railties-5.1.7/lib/rails/initializable.rb:30:in `instance_exec' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/railties-5.1.7/lib/rails/initializable.rb:30:in `run' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/railties-5.1.7/lib/rails/initializable.rb:59:in `block in run_initializers' from /Users/barrybrinkley/.rubies/ruby-2.4.6/lib/ruby/2.4.0/tsort.rb:228:in `block in tsort_each' from /Users/barrybrinkley/.rubies/ruby-2.4.6/lib/ruby/2.4.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component' from /Users/barrybrinkley/.rubies/ruby-2.4.6/lib/ruby/2.4.0/tsort.rb:431:in `each_strongly_connected_component_from' from /Users/barrybrinkley/.rubies/ruby-2.4.6/lib/ruby/2.4.0/tsort.rb:349:in `block in each_strongly_connected_component' from /Users/barrybrinkley/.rubies/ruby-2.4.6/lib/ruby/2.4.0/tsort.rb:347:in `each' from /Users/barrybrinkley/.rubies/ruby-2.4.6/lib/ruby/2.4.0/tsort.rb:347:in `call' from /Users/barrybrinkley/.rubies/ruby-2.4.6/lib/ruby/2.4.0/tsort.rb:347:in `each_strongly_connected_component' from /Users/barrybrinkley/.rubies/ruby-2.4.6/lib/ruby/2.4.0/tsort.rb:226:in `tsort_each' from /Users/barrybrinkley/.rubies/ruby-2.4.6/lib/ruby/2.4.0/tsort.rb:205:in `tsort_each' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/railties-5.1.7/lib/rails/initializable.rb:58:in `run_initializers' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/railties-5.1.7/lib/rails/application.rb:353:in `initialize!' from /Users/barrybrinkley/code/bark/barkbox-rails/config/environment.rb:5:in `<top (required)>' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/activesupport-5.1.7/lib/active_support/dependencies.rb:292:in `require' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/activesupport-5.1.7/lib/active_support/dependencies.rb:292:in `block in require' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/activesupport-5.1.7/lib/active_support/dependencies.rb:258:in `load_dependency' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/activesupport-5.1.7/lib/active_support/dependencies.rb:292:in `require' from config.ru:3:in `block in <main>' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/rack-2.0.8/lib/rack/builder.rb:55:in `instance_eval' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/rack-2.0.8/lib/rack/builder.rb:55:in `initialize' from config.ru:in `new' from config.ru:in `<main>' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/rack-2.0.8/lib/rack/builder.rb:49:in `eval' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/rack-2.0.8/lib/rack/builder.rb:49:in `new_from_string' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/rack-2.0.8/lib/rack/builder.rb:40:in `parse_file' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/rack-2.0.8/lib/rack/server.rb:319:in `build_app_and_options_from_config' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/rack-2.0.8/lib/rack/server.rb:219:in `app' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/railties-5.1.7/lib/rails/commands/server/server_command.rb:24:in `app' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/rack-2.0.8/lib/rack/server.rb:354:in `wrapped_app' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/railties-5.1.7/lib/rails/commands/server/server_command.rb:80:in `log_to_stdout' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/railties-5.1.7/lib/rails/commands/server/server_command.rb:42:in `start' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/railties-5.1.7/lib/rails/commands/server/server_command.rb:135:in `block in perform' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/railties-5.1.7/lib/rails/commands/server/server_command.rb:130:in `tap' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/railties-5.1.7/lib/rails/commands/server/server_command.rb:130:in `perform' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/thor-0.20.3/lib/thor/command.rb:27:in `run' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/railties-5.1.7/lib/rails/command/base.rb:63:in `perform' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/railties-5.1.7/lib/rails/command.rb:44:in `invoke' from /Users/barrybrinkley/.gem/ruby/2.4.6/gems/railties-5.1.7/lib/rails/commands.rb:16:in `<top (required)>' from bin/rails:4:in `require' from bin/rails:4:in `<main>'
Ruby 2.4.6 Rails 5.1.7
No caching that I'm aware of.
It's worth noting that the above stack trace is from authz 0.0.4 but I get the same one with version 0.0.5. I tried downgrading to see if that helped.
Hi @bark-barry ! Thanks for reporting this.
In addition to the above, do you happen to have any public repo we can clone that is showing the error?
That would greatly help us to troubleshoot this and get back to you faster.
Unfortunately not. The repo in question is private and has to remain as such.
I’m happy to try some things if you like though and post the results.
Thank you, -Barry
Sent from a mobile device. Please forgive terseness and typos.
Hey Barry!
Noted, no worries.
Have you tested this behavior in a fresh app with those versions of ruby and rails?
On Tue, 14 Jan 2020 at 1:06 pm, bark-barry notifications@github.com wrote:
Unfortunately not. The repo in question is private and has to remain as such.
I’m happy to try some things if you like though and post the results.
Thank you, -Barry
Sent from a mobile device. Please forgive terseness and typos.
On Jan 13, 2020, at 7:50 PM, Sergio Rodríguez notifications@github.com wrote:
Hi @bark-barry ! Thanks for reporting this.
In addition to the above, do you happen to have any public repo we can clone that is showing the error?
That would greatly help us to troubleshoot this and get back to you faster.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.
— You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/serodriguez68/authz/issues/24?email_source=notifications&email_token=ACTMDBS7KMYU3TUELWQUK5TQ5UMYXA5CNFSM4KGIR4V2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEI276UQ#issuecomment-573964114, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACTMDBWA2TZMWEQTJ5OGFK3Q5UMYXANCNFSM4KGIR4VQ .
-- Julián Pinzón Eslava Músico ll Ingeniero de Sonido Bogotá, Colombia +57 316 300 4416
I have not.
Thank you, -Barry
Sent from a mobile device. Please forgive terseness and typos.
Hey Barry,
I've investigated your issue and put a fix in place. The error was on our side, sorry for that.
Can you please try with the following branch and let us know if the issue goes away?
In your Gemfile replace gem 'authz;
by:
gem 'authz', git: "git://github.com/serodriguez68/authz.git", branch:"issue24/cache_versioning_not_defined_in_rails_51"
Once you confirm, we will proceed and release an updated stable version with the fix in place.
Please note that you may also run into a different issue in Rails 5.1 related to migrations. See #25 for a full description of the issue and a temporary workaround while we fix it.
So that gets the app to boot (Yay!) but when I try to view a page I get a new error:
#<NoMethodError: undefined method `cached_has_permission?' for :user:Symbol>
Alright (Yay!)
That looks like a configuration issue on your app. Make sure that:
Authz::Models::Rolable
in your model responsible of managing Users.
class User < ApplicationRecord
include Authz::Models::Rolable
authz_label_method :email
# ...
end
Authz.configure do |config|
# ...
# The method used to access the current user
config.current_user_method = :current_user
# ...
end
If none of this work, please try this (skip steps that you have already done):
rails authz:seed_admin
rails console
role = Authz::Role.create(name: 'superadmin', description: 'can fully manage the authz admin')
authz::seed_admin
) role << Authz::BusinessProcess.find_by(code: :manage_authorization)
user = User.last
and then user << role
user.roles
must return a collection of Authz::Roles
including the one you just granted.If everything above is ok and it doesn't work, please get back to us.
Unsure what would cause this, but rails won't even boot. Using Rails5. Let me know what information would be helpful in troubleshooting this.