Ruby on rails 如何在服务对象中访问设计登录

Ruby on rails 如何在服务对象中访问设计登录,ruby-on-rails,devise,Ruby On Rails,Devise,我正在尝试将一些代码移出控制器并移入服务对象。如何从服务对象访问design_in helper方法 class CompleteAccountRegistration def self.call(account_id, plan_id) @account = Account.find(account_id) self.create_user_account self.create_subscription(plan_id) sign_in(User.fin

我正在尝试将一些代码移出控制器并移入服务对象。如何从服务对象访问design_in helper方法

class CompleteAccountRegistration

  def self.call(account_id, plan_id)
    @account = Account.find(account_id)
    self.create_user_account
    self.create_subscription(plan_id)
    sign_in(User.find(@account.owner_id))
  end
我在测试中遇到以下错误

 NoMethodError:
   undefined method `sign_in' for CompleteAccountRegistration:Class

在您的服务对象中包括
designe::Controllers::SignInOut
,就可以做到这一点

我有这个问题。我尝试将
include designe::Controllers::Helpers
添加到我的服务对象中,但随后我得到了unpersonateuser:Class`的
未定义方法
helper\u方法'。我想我还需要包括一些其他的东西。有人解决了这个问题吗?我遇到了同样的问题。不幸的是,这对我不起作用,仍然收到:
NoMethodError:CompleteAccountRegistration的未定义方法“登录”:类
您使用的是什么版本的Desive?可能与此相关。使用
designe(3.4.1)
,添加了
include designe::Controllers::SignInOut