Skip to content

Commit

Permalink
Extract check out of nested parens
Browse files Browse the repository at this point in the history
  • Loading branch information
kaspth committed Dec 14, 2023
1 parent d61f94d commit 7aad146
Showing 1 changed file with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,8 @@ def account_load_and_authorize_resource(model, options, old_options = {})

through_as_symbols.each do |through_as_symbol|
# reflect on the belongs_to association of the child model to figure out the class names of the parents.
unless (
association =
model_class_name.constantize.reflect_on_association(
through_as_symbol
)
)
association = model_class_name.constantize.reflect_on_association(through_as_symbol)
unless association
raise "Oh no, it looks like your call to 'account_load_and_authorize_resource' is broken. Tried to reflect on the `#{through_as_symbol}` association of #{model_class_name}, but didn't find one."
end

Expand Down

0 comments on commit 7aad146

Please sign in to comment.