Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support overwriting scope blocks #126

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jusleg
Copy link

@jusleg jusleg commented Mar 19, 2025

Previously, block was only able to be configured via the first scope definition. If it was redefined to add a scope or change the scope, it wouldn't get configured due to the conditional assignment operator. The current limitation is that we cannot unset the block if it's set in a parent. The only way to do it would be to pass an empty block.

has_scope :some_scope do |controller, scope|
  scope.something(...)
end

# overwritten block for scope
has_scope :some_scope { # no-op }

Previously, block was only able to be configured via the first scope
definition. If it was redefined to add a scope or change the scope, it
wouldn't get configured due to the conditional assignment operator.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant