← Back to Upcase

What does the super action do?

(Jason Pierce) #1

I have a sessions controller namespaced to users and it has a destroy method with super in it. What is the ‘super’ doing?

class Users::SessionsController < Devise::SessionsController
  def destroy



(Matthew Mongeau) #2

The super is calling the destroy action in Devise::SessionsController. However, this is completely unnecessary as leaving the destroy method off would cause it to call the destroy action of the Devise::SessionsController anyways.

(Jason Pierce) #3

Thanks for the advice, that is helpful. In this controller both the destroy and new methods are setup this way. Once I fixed a domain dns issue they started working straight away.