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 8118731
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T04:35:09+00:00 2026-06-06T04:35:09+00:00

Error: undefined method `author’ for nil:NilClass In my helper: def last_updated(group) g = group.last_updated_version

  • 0

Error:

undefined method `author' for nil:NilClass

In my helper:

def last_updated(group)
  g = group.last_updated_version
  debugger
  g.author.name
end

If I let my last_updated(group) function return group.last_updated_version, the view prints out my object as expected:

#<Assets::Version:0x0000000747af48>

And using the debugger at the point shown above, I can pull out the name

(rdb:1) g.author.name
"Administrator"

But returning group.last_updated_version.author.name results in the error.

Can anyone tell me why group.last_updated_version seems to return my object, but group.last_updated_version.author gives me the nil:NilClass error?

  • 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-06T04:35:12+00:00Added an answer on June 6, 2026 at 4:35 am

    Sorry, silly problem. The helper last_updated() is used in a loop. My method last_updated_version returned nil for some of the group objects it was passed, but not the first. The debugger obviously stops on the first, so it worked in the debugger, but then broke on groups passed after that.

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

Sidebar

Related Questions

undefined method 'key?' for nil:NilClass This is the error I am getting while going
I am getting an error: Undefined method build for nil:NilClass when trying to build
I get this error: undefined method 'vote_sum' for nil:NilClass for this line in my
I'm getting this strange error using Rails 3.0.2. ActionView::Template::Error (undefined method `parent' for nil:NilClass):
I get the following error: undefined method `[]' for nil:NilClass The related snippet in
I have this error: undefined method `[]' for nil:NilClass Extracted source (around line #16):
I getting the error undefined method `update_attributes' for nil:NilClass when using Sinatra with MongoMapper.
I'm getting the error: undefined method `model_name' for NilClass:Class when trying to call the
I keep getting a undefined method 'comments' for nil:NilClass in my create method when
I got this error: undefined method `test_path' for #<#<Class:0x4022a00>:0x4028ee0> I made this link: <%=

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.