How to override devise's "create" method?

2

Hello,

I need to override the devise "create" method to make a certain logic before saving the user. But I do not know the way of stones to make such a change. I already researched google but the examples were not clear to me.

I generated the controllers for the "User" model created by the device with the rails g devise:controllers users command. And I thought about overwriting the "create" method generated in this controller, and that's where I caught it!

Could you kindly post the path I should follow?

    
asked by anonymous 26.05.2017 / 16:14

1 answer

1

Hello,

In its RegistrationsController that extends from Devise::RegistrationsController the create override can be as follows:

def create
  super 
  #sua lógica
  resource.save
end

I hope you have helped.

    
26.05.2017 / 19:10