Skip to content

has_role? does not work for new_records #593

@akefeli

Description

@akefeli
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions