Open olivierobert opened 3 years ago
While working with Rails, I thought that "execute" an action would make more sense semantically, so I used exec for service. But it introduces inconsistencies in the codebase just like you said. Thanks for you feedback.
The method call
is more standard as it relates to lambda
. Basically, any object which has a method call can be executed in a lambda. You can read more about it in this article: https://blog.eq8.eu/article/ruby-call-method.html
API controller use the method
call
:https://github.com/tamle-dev/google-crawler/blob/e96384b0aa9a5473f7206c7f5c16aab5177f002e/app/controllers/api/v1/get_keyword_controller.rb#L5-L12
While service classes use `exec:
https://github.com/tamle-dev/google-crawler/blob/e96384b0aa9a5473f7206c7f5c16aab5177f002e/app/services/keyword_service/updater.rb#L11-L14
Because it introduces inconsistencies in the codebase, it would be great to understand the rational behind this difference.