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

Add feature to allow selectively skipping scope argument sanitization. #933

Conversation

justinh24
Copy link
Contributor

Currently Ransack documentation suggests you implement your own sanitization if you need the ability to pass truth-y values to a scope (1,0,t,f,etc.). I have provided an add one to allow one to list scopes which should not be sanitized, and to continue using the existing mechanism for all other scopes.

This is particularly handy if you are passing form inputs into a scope. (i.e. Power Search which searches across multiple fields)

@justinh24 justinh24 changed the title Add feature to all selectively skipping scope argument sanitization. Add feature to allow selectively skipping scope argument sanitization. Jul 17, 2018
CHANGELOG.md Outdated
@@ -1,5 +1,14 @@
# Change Log

## Version

### Added
Copy link
Member

Choose a reason for hiding this comment

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

You can leave this one out.

CHANGELOG.md Outdated

* Add the ability to skip arg sanitization on a per scope basis. Using
`ransackable_scopes_skip_sanitize_args`, users can define a list of
scopes which will bypass parameter sanitization. This allows passing 0,
Copy link
Member

Choose a reason for hiding this comment

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

There is an extra space before This allows

@@ -64,6 +64,14 @@ def ransackable_scopes(auth_object = nil)
[]
end

# ransack_scope_skip_sanitize_args, by efault, returns an empty array.
Copy link
Member

Choose a reason for hiding this comment

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

there is a typo at by default

@gregmolnar
Copy link
Member

@justinh24 Thanks for your contribution! It is looking good to me, I just found a few copy issues.

@gregmolnar
Copy link
Member

@justinh24 thanks! Could you please squash the 2 commits and I will merge it, thank you!

@justinh24 justinh24 force-pushed the selectively_skip_scope_sanitizing branch from f1e65ba to b006677 Compare July 24, 2018 18:33
@justinh24 justinh24 force-pushed the selectively_skip_scope_sanitizing branch from b006677 to 24a4d43 Compare July 24, 2018 18:36
@justinh24
Copy link
Contributor Author

@gregmolnar Sorry about forgetting to squash. Hopefully this will be good now. Thanks!

@justinh24
Copy link
Contributor Author

Hmm.. there were no changes other than merges than squashing the branches. Is this a travis error? It looks like a possible timeout.

@gregmolnar
Copy link
Member

Looks like a timeout indeed. I restarted it, let's see if that helps.
Thanks for your contribution!

@gregmolnar gregmolnar merged commit 6bcfcc1 into activerecord-hackery:master Jul 24, 2018
@justinh24 justinh24 deleted the selectively_skip_scope_sanitizing branch July 24, 2018 19:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants