RolifyCommunity / rolify

Role management library with resource scoping
https://rolifycommunity.github.io/rolify/
MIT License
3.16k stars 404 forks source link

has_role? does not work for new_records #593

Open akefeli opened 1 year ago

akefeli commented 1 year ago
irb(main):045:0> u=User.new
irb(main):046:0> u.add_role :admin
irb(main):047:0> u.has_role? :admin

.../lib/ruby/gems/3.2.0/gems/activemodel-7.0.6/lib/active_model/attribute_methods.rb:450:in `method_missing': undefined method `resource' for #<Role id: 1, name: "ad
min", resource_type: nil, resource_id: nil, created_at: "2023-07-09 22:46:05.337459000 +0000", updated_at: "2023-07-09 22:46:05.337459000 +0000"> (NoMethodError)
Did you mean?  resource_id