SooDesuNe
SooDesuNe

Reputation: 10030

Thoughtbot's Clearance gem, overriding url_after_destroy

I was able to successfully override url_after_create, but my url_after_destroy is being ignored.

What am I messing up?

routes:

  map.resource  :session,
    :controller => 'sessions',
    :only => [:new, :create, :destroy]

my Sessions controller:

class SessionsController < Clearance::SessionsController
  private
    def url_after_create
      puts "************after create****************"  #called on sign in
    end

  def url_after_destroy
    puts "************after destroy****************"  #never called
  end
end

Upvotes: 1

Views: 739

Answers (1)

SooDesuNe
SooDesuNe

Reputation: 10030

The docs say:

You may also need to add code such as the following to your routes.rb:

 map.sign_out 'sign_out',
     :controller => 'sessions',
     :action     => 'destroy',
     :method     => :delete

That's what I'm missing. Perhaps 'may' is not the best choice of verb for documentation.

Upvotes: 0

Related Questions