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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T15:57:29+00:00 2026-05-19T15:57:29+00:00

I have some inherited code that I am modifying. However, I am seeing something

  • 0

I have some inherited code that I am modifying. However, I am seeing something strange(to me).

I see some code like this:

::User.find_by_email(params[:user][:email]).update_attributes(:mag => 1)

I have never seen something like this(I am new to Ruby on Rails). What does this do and why doesn’t my User.find_by_email(params[:user][:email]).update_attributes(:mag => 1) work? The error says something about the User constant.

I am using Rails 2.3.5 if that helps.

  • 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-19T15:57:29+00:00Added an answer on May 19, 2026 at 3:57 pm

    :: is a scope resolution operator, it effectively means “in the namespace”, so ActiveRecord::Base means “Base, in the namespace of ActiveRecord“

    A constant being resolved outside of any namespace means exactly what it sounds like – a constant not in any namespace at all.

    It’s used in places where code may be ambiguous without it:

    module Document
      class Table # Represents a data table
    
        def setup
          Table # Refers to the Document::Table class
          ::Table # Refers to the furniture class
        end
    
      end
    end
    
    class Table # Represents furniture
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have inherited some code. I see that this code exists: private List<int> Data
I have some inherited JS code that uses this format: function main(param) { var
I have inherited some code (that happens a lot!) which looks a bit like
So I have some code that looks like this, written in and compiled with
I have some code that I've inherited from someone very clever where they like
We have some code that looks a bit like this (error handling and other
I have inherited some really old VC6.0 code that I am upgrading to VS2008
I have some ASP code that I've inherited from my predecessor (no, it's not
I have inherited some code which involves a scheduled task that writes data (obtained
I have inherited some code that queries a DB over a WCF service and

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.