mirror of
https://github.com/discourse/discourse.git
synced 2025-05-25 19:29:34 +08:00
DEV: Drop WithServiceHelper
This patch removes the `with_service` helper from the code base. Instead, we can pass a block with actions directly to the `.call` method of a service. This simplifies how to use services: - use `.call` without a block to run the service and get its result object. - use `.call` with a block of actions to run the service and execute arbitrary code depending on the service outcome. It also means a service is now “self-contained” and can be used anywhere without having to include a helper or whatever.
This commit is contained in:

committed by
Loïc Guitaut

parent
c76ff5c994
commit
e94707acdf
@ -1,8 +1,6 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class Admin::AdminController < ApplicationController
|
||||
include WithServiceHelper
|
||||
|
||||
requires_login
|
||||
before_action :ensure_admin
|
||||
|
||||
|
Reference in New Issue
Block a user