mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 20:36:39 +08:00
f79dd5c8b5
Currently, when calling a service with its block form, a `#result` method is automatically created on the caller object. Even if it never clashed so far, this could happen. This patch removes that method, and instead use a more classical way of doing things: the result object is now provided as an argument to the main block. This means if we need to access the result object in an outcome block, it will be done like this from now on: ```ruby MyService.call(params) do |result| on_success do # do something with the result object do_something(result) end end ``` In the same vein, this patch introduces the ability to match keys from the result object in the outcome blocks, like we already do with step definitions in a service. For example: ```ruby on_success do |model:, contract:| do_something(model, contract) end ``` Instead of ```ruby on_success do do_something(result.model, result.contract) end ``` |
||
---|---|---|
.. | ||
config | ||
admin_controller.rb | ||
admin_notices_controller.rb | ||
api_controller.rb | ||
backups_controller.rb | ||
badges_controller.rb | ||
color_schemes_controller.rb | ||
dashboard_controller.rb | ||
email_controller.rb | ||
email_styles_controller.rb | ||
email_templates_controller.rb | ||
embeddable_hosts_controller.rb | ||
embedding_controller.rb | ||
emojis_controller.rb | ||
form_templates_controller.rb | ||
groups_controller.rb | ||
impersonate_controller.rb | ||
permalinks_controller.rb | ||
plugins_controller.rb | ||
reports_controller.rb | ||
robots_txt_controller.rb | ||
screened_emails_controller.rb | ||
screened_ip_addresses_controller.rb | ||
screened_urls_controller.rb | ||
search_logs_controller.rb | ||
section_controller.rb | ||
site_settings_controller.rb | ||
site_texts_controller.rb | ||
staff_action_logs_controller.rb | ||
staff_controller.rb | ||
themes_controller.rb | ||
user_fields_controller.rb | ||
users_controller.rb | ||
versions_controller.rb | ||
watched_words_controller.rb | ||
web_hooks_controller.rb |