I am trying to move some code out of my controller and into a service object. How do I access the devise sign_in helper method from the service object.
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
I am getting the following error in my tests.
NoMethodError:
undefined method `sign_in' for CompleteAccountRegistration:Class
在服务对象中包含Devise::Controllers::SignInOut
就可以了!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.