Switch from http to https and reverse

I want to redirect some of requests from http to https, and that is
working, but it don’t wanna redirect back from https to http
UNSECURED_ACTIONS is a
Any hints?

UNSECURED_ACTIONS = [ :signup, :login, :logout, :thanx, :index ]

def default_url_options(options)
# this is bad :frowning:
UNSECURED_ACTIONS.include?(options[:action]) ? { :protocol =>
‘http://’, :host => :host + ‘:3000’ } : { :protocol => ‘https://’,
:host => ‘localhost’ }
end

thanx