-
Notifications
You must be signed in to change notification settings - Fork 24
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
422 deactivate services when parent resource is deactivated #431
base: master
Are you sure you want to change the base?
422 deactivate services when parent resource is deactivated #431
Conversation
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.
Some small comments, but otherwise LGTM
|
||
module Services | ||
module Resources | ||
include Errors |
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.
Rails might auto-load this module, so I think it might be possible to delete this include Errors
line here. In development mode, Rails lazily loads modules, so when it encounters raise Errors::PreconditionFailed
, it will go look for the appropriate file and load it into scope.
remove_from_algolia(service) | ||
end | ||
|
||
def self.remove_from_algolia(service) |
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.
Maybe this can be factored out as a common utility since it is used in both services? Might be able to put it in app/services/utils.rb
? Perhaps the error log message can be generalized as follows:
def self.remove_from_algolia(record)
record.remove_from_index!
rescue StandardError
puts "failed to remove #{record.class} #{record.id} from algolia index"
end
# frozen_string_literal: true | ||
|
||
module Services | ||
module Resources |
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.
Might be cool to add some rspec tests for these services, but if their functionality is already covered by the Postman tests, there is probably no need.
Haha, looks like Rubocop wants you to add empty newlines after the |
No description provided.