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
6 changes: 3 additions & 3 deletions lib/accessly/permission/grant.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ class Grant < Accessly::Base
# @param actor [ActiveRecord::Base] The actor to grant 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::GrantError.new("Actor is not an ActiveRecord::Base object")
end
Expand Down
Loading