-
Notifications
You must be signed in to change notification settings - Fork 368
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 type specific settings #341
Conversation
@@ -47,6 +51,10 @@ def self.scopes | |||
public_methods - Chewy::Type.public_methods | |||
end | |||
|
|||
def self.settings(params) | |||
self._settings = self._settings.deep_merge(params) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should params keys be restricted to "known settings"? Like:
KNOWN_SETTINGS = %i[import_options]
...
def self.settings(params)
unknown_settings = params.each_key.select { |key| !KNOWN_OPTIONS.include?(key) }
raise ArgumentError, "Unknown settings: #{unknown_settings.join(', ')}" unless unknown_settings.empty?
self._settings = self._settings.deep_merge(params)
end
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not? Also, http://apidock.com/rails/Hash/assert_valid_keys
I think |
It allows to set default options for import per type.
ea30e3a
to
82828e5
Compare
@pyromaniac Is it better now? |
Yeah, much better, thanks! |
As mentioned in #340 adding per type settings for import options would be a nice idea. It allows to tune batch size for each defined type specifically.
@pyromaniac What do you think about it?