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

Allow ActionController::Parameters as inputs #383

Merged
merged 3 commits into from
Sep 13, 2016
Merged

Conversation

tfausak
Copy link
Collaborator

@tfausak tfausak commented Sep 8, 2016

This fixes #381.

@tfausak tfausak self-assigned this Sep 8, 2016
@tfausak tfausak added the bug label Sep 8, 2016
@tfausak
Copy link
Collaborator Author

tfausak commented Sep 8, 2016

Can you review this, @AaronLasseigne? Here are links to relevant documentation in Rails:

klass = 'ActionController::Parameters'.safe_constantize
if !klass || !inputs.is_a?(klass)
raise ArgumentError, 'inputs must be a hash'
end
Copy link
Owner

Choose a reason for hiding this comment

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

Right now the code goes, good, bad, good. It might work better to group the good paths.

return inputs if inputs.is_a?(Hash)

klass = 'ActionController::Parameters'.safe_constantize
if klass && inputs.is_a?(klass)
  return inputs.to_unsafe_h
end

raise ArgumentError, 'inputs must be a hash'

@AaronLasseigne
Copy link
Owner

👍

@tfausak tfausak merged commit 875fd0b into master Sep 13, 2016
@tfausak tfausak deleted the gh-381-parameters branch September 13, 2016 23:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rails 5 ActionController::Parameters no longer inherits from Hash
2 participants