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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T20:03:31+00:00 2026-06-07T20:03:31+00:00

In my Rails 3.0.11 app, we have very simple code in a controller: def

  • 0

In my Rails 3.0.11 app, we have very simple code in a controller:

def index
  @record = Record.valid # scope around 80,000 records
  asdfasdfsa # consider this is a typo to raise NameError Exception
end

The interesting thing is that when it came to the typo, the app seems to query/execute the @record instance variable first before raising an exception. The query costs almost 1 min to get records. So in browser, the page hanges for a long while before coming into an exception template.

If I replace @record with a local variable “record”, the querying doesn’t happen at all. Anyone knows what it is going on?

  • 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-07T20:03:32+00:00Added an answer on June 7, 2026 at 8:03 pm

    See my blog post Ruby’s Inspect Considered Harmful for details about this very issue. In short, though:

    1. NameError calls inspect when formatting its error message
    2. The default implementation of inspect calls inspect on all instance variables recursively
    3. NameError throws away the result of inspect if it is longer than 65 characters
    4. For us, this meant that a typo in a View caused Rails to hang for 20 minutes while Ruby built a huge, 20MB string and then proceeded to throw it away
    5. It took us 7 months to get a trivial fix for this into Rails core

    In short, I consider the behaviour of NameError to be a heinous bug within the Ruby interpreter. I can think of no sane reason for this implementation.

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

Sidebar

Related Questions

I have a very simple admin controller in my Rails 2 app that displays
I have a very basic rails app. I am playing around with validation. Controller
I have a very simple Rails app with a very simple relational database: Category
I am following a tutorial for building a very simple rails app. I have
I have created a very simple Rails 3.1 app with basic stuffs like following:
We have a very simple use of datepicker in rails 3.1.3 app with jquery.
I am creating a rails app and have used this code in one of
I've got a very simple Rails 3 app with a User model run by
I have a simple rails application with a few controller and some rake tasks.
I'm trying to do something very simple in my first Rails app (Rails 3)

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.