Hi,
If someone is already logged in, I would like to redirect them to a
different page. I have that code in my app/controllers/
register_controller.rb file:
class RegisterController < ApplicationController
…
def start
if (logged_in?)
redirect_to :controller => “order”, :action =>
“start”
end
end
…
end
but I’m getting an error if someone is not logged in. Visiting
http://mydomain.com/register/start gives this error:
NoMethodError in RegisterController#start
undefined method `authenticate_with_http_basic’ for
#RegisterController:0xb75ed528
RAILS_ROOT: ./script/…/config/…
Application Trace | Framework Trace | Full Trace
/usr/local/apache2/htdocs/easyrx/lib/authenticated_system.rb:102:in
login_from_basic_auth' /usr/local/apache2/htdocs/easyrx/lib/authenticated_system.rb:12:in
current_user’
/usr/local/apache2/htdocs/easyrx/lib/authenticated_system.rb:6:in
logged_in?' /usr/local/apache2/htdocs/easyrx/app/controllers/ register_controller.rb:40:in
start’
The method in question is located in lib/authenticated_system.rb, and
I’ve included that in my app/controllers/application.rb file:
class ApplicationController < ActionController::Base
Be sure to include AuthenticationSystem in Application Controller
instead
include AuthenticatedSystem
What does the error mean and how can I resolve it? Thanks, - Dave