Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/accessly/permission/revoke.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ class Revoke < Accessly::Base
# @param actor [ActiveRecord::Base] The actor to revoke permission
def initialize(actor)
super(actor)
@actor = case actor
when ActiveRecord::Base
actor

if actor.is_a?(ActiveRecord::Base)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/GuardClause: Use a guard clause instead of wrapping the code inside a conditional expression.

@actor = actor
else
raise Accessly::RevokeError.new("Actor is not an ActiveRecord::Base object")
raise Accessly::GrantError.new("Actor is not an ActiveRecord::Base object")
end
end

Expand Down
Loading