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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:53:06+00:00 2026-05-27T03:53:06+00:00

Have anyone noticed something like this? Why is it happening? ruby-1.9.2-p290 :006 > User.count

  • 0

Have anyone noticed something like this? Why is it happening?

ruby-1.9.2-p290 :006 > User.count
   (0.4ms)  SELECT COUNT(*) FROM "users" 
 => 102 
ruby-1.9.2-p290 :007 > User.count + 1
   (0.4ms)  SELECT COUNT(*) FROM "users" 
 => 103 
ruby-1.9.2-p290 :008 > User.count+ 1
   (0.4ms)  SELECT COUNT(*) FROM "users" 
 => 103 
ruby-1.9.2-p290 :009 > User.count+1
   (0.4ms)  SELECT COUNT(*) FROM "users" 
 => 103 
ruby-1.9.2-p290 :010 > User.count +1
   (0.5ms)  SELECT COUNT(1) FROM "users" 
 => 102 

Using ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-linux] && Rails 3.1.3

Extra stuff:

ruby-1.9.2-p290 :007 > "ayay".length + 1
 => 5 
ruby-1.9.2-p290 :008 > "ayay".length +1
ArgumentError: wrong number of arguments(1 for 0)
    from (irb):8:in `length'
    ...
  • 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-05-27T03:53:06+00:00Added an answer on May 27, 2026 at 3:53 am

    This depends on the fact that in Ruby white spaces can be significant. You see different results because Ruby interprets your example in different ways. So

    The first:

    "ayay".length + 1
    

    is like

    "ayay".length.+(1)
    

    And the second:

    "ayay".length +1
    

    is like

     "ayay".length(+1)
    

    In this way you can see why Ruby gives an error in the second case.

    Regarding the count problem: Ruby interprets the code as:

    User.count(+1)
    

    And, as you can see from the generated SQL, there is a difference because +1 is considered the column_name parameter.

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

Sidebar

Related Questions

I have a large ARFF file with data that looks something like this: 555,2011-03-13
i have just noticed something strange in some asp.net markup. I have a standard
I have a little web app that uses the Facebook like widget. This page
I noticed something weird today I would like explained. I wasn't 100% sure how
Does anyone have any idea of why this could happen? I have a C
Welcome, I notice that Youtube make some changes into their website code. Anyone have
Have anyone successfully managed to setup a combined Java/C++ project for Eclipse? What I
Does anyone have any recommendations of tools that can be of assistance with moving
Does anyone have a definitive answer to whether Sql Server Management Objects is compatible
Does anyone have the secret formula to resizing transparent images (mainly GIFs) without ANY

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.