Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8970515
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:44:14+00:00 2026-06-15T17:44:14+00:00

on my site, I’m checking to see if the user has been authenticated. I

  • 0

on my site, I’m checking to see if the user has been authenticated. I have in my controller the following..

def index
  login_required
  @profile = current_user.profile  ### line 9
  ..

Then in my application_controller, I have the definition of the login_required method..

def login_required
  unless current_user
    redirect_to root_path, :notice => "Please login first"
  end
end

Even though my log shows me that the redirection to root is happening, it’s still not really taking me to the root path, and rather takes me back to my controller->index
and errors out on the line “@profile = current_user.profile”. here’s the log..

Started GET "/meetings" for 127.0.0.1 at 2012-12-05 12:18:12 -0800
  Processing by xyzController#index as HTML
Redirected to http://localhost:3000/
Completed 500 Internal Server Error in 1ms

NoMethodError (undefined method `profile' for nil:NilClass):
  app/controllers/xyz_controller.rb:9:in `index'

Why am I not being redirected to the root path (which is my home page) even though it’s saying that it’s redirecting? Any ideas? Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T17:44:14+00:00Added an answer on June 15, 2026 at 5:44 pm

    Processing keeps happening after redirect_to – there’s no implicit return. The band-aid fix is to add a return in your index action depending on the result of login_required, but the better way is to use a filter in your controller.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

my site is hosted at IIS7.5 i have a controller action as below [HttpPost]
My site is in VB using VS 2010, and my z-index property I have
(Actual site names have been changed) I installed drupal on elephantboarding.com, and it is
My site has three columns. I have two fields within a form that need
My site has been successfully verified against Google Webmaster. My crawler access with the
My site has its own login system and the user can choose to connect
Site: http://clientfiles.priworks.com/lgmanagedportfolios/test/investment.html I have been working at this web page for a while now
site.com/link?p=2 give $_GET['p']==2 even though i've already made site.com/link rewrite to site.com/index.php?page=link So, i'm
The site I'm currently working on has a series of videos on a carousel
My site, which is built on Python/Postgresql with django, has an area where you

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.