Skip to content

Eager autoloading required to avoid errors #2

Description

@mach-kernel
[2] pry(main)> Ability.new(User.first)
D, [2018-07-16T21:31:37.434025 #13581] DEBUG -- :   User Load (0.4ms)  SELECT  "users".* FROM "use
rs" ORDER BY "users"."id" ASC LIMIT $1  [["LIMIT", 1]]
D, [2018-07-16T21:31:37.435883 #13581] DEBUG -- :    (0.3ms)  SELECT "roles"."name" FROM "roles" I
NNER JOIN "roles_users" ON "roles"."id" = "roles_users"."role_id" WHERE "roles_users"."user_id" =
$1  [["user_id", 1]]
NoMethodError: undefined method `permissions' for nil:NilClass
from /Users/mach/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/bundler/gems/warhol-206ccd0bdd0b/lib/wa
rhol/router.rb:37:in `block in apply_permissions'

Can be resolved with, but needs documentation:

Policy.constants.each { |c| Policy.const_get(c)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions