Is there any way I can get the controller that’s about to handle the request from ApplicationController class?
Basically I’m trying to figure out a way of returning to HTTP when HTTPS is no longer required. I have configured Devise to use SSl as instructed:
#in config/environments/production.rb
config.to_prepare { Devise::SessionsController.force_ssl }
config.to_prepare { Devise::RegistrationsController.force_ssl }
However, once a Devise controller redirects to SSL it stayed there. There was a code snippet in the Devise wiki that redirects back to HTTP once a Devise action is completed. However, that won’t work if user navigates away using any other means.
From my .NET way of thinking perhaps I can do something in the base class of all controllers, i.e. ApplicationController. If I can have an array of controller class names that require SSL, then redirects to HTTP if the current controller class does not require it, perhaps that will be a sufficient crude solution for now? I am a Ruby and Rails newbie so I may not be looking at this the right way at all…
Thanks,
Dany.
You can see the current controller name in the
paramshash:params[:controller].