Skip to content

Commit

Permalink
linter again
Browse files Browse the repository at this point in the history
  • Loading branch information
jagthedrummer committed Aug 31, 2023
1 parent ebb7033 commit e5e8ba8
Showing 1 changed file with 19 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -169,35 +169,35 @@ def account_load_and_authorize_resource(model, options, old_options = {})

# 3. on action resource, we have a specific id for the child resource, so load it directly.
load_and_authorize_resource model,
options.merge(
class: model_class_name,
only: member_actions,
prepend: true,
shallow: true
)
options.merge(
class: model_class_name,
only: member_actions,
prepend: true,
shallow: true
)

# 2. only load the child resource through the parent resource for collection actions.
load_and_authorize_resource model,
options.merge(
class: model_class_name,
through: through_as_symbols,
only: collection_actions,
prepend: true,
shallow: true
)
options.merge(
class: model_class_name,
through: through_as_symbols,
only: collection_actions,
prepend: true,
shallow: true
)

# 1. load the parent resource for collection actions only. (we're using shallow routes.)
# since a controller can have multiple potential parents, we have to run this as a loop on every possible
# parent. (the vast majority of controllers only have one parent.)

through_class_names.each_with_index do |through_class_name, index|
load_and_authorize_resource through_as_symbols[index],
options.merge(
class: through_class_name,
only: collection_actions,
prepend: true,
shallow: true
)
options.merge(
class: through_class_name,
only: collection_actions,
prepend: true,
shallow: true
)
end
end
end
Expand Down

0 comments on commit e5e8ba8

Please sign in to comment.