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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:45:40+00:00 2026-05-26T16:45:40+00:00

I am getting started with a non-SQL database (specifically, MongoDB) and Ruby on Rails

  • 0

I am getting started with a non-SQL database (specifically, MongoDB) and Ruby on Rails because I believe flexible schemas will be an advantage. Right now, I’m confused because some things I expect to “just work” aren’t working. Specifically, I have a “method missing” error on one of my pages.

NoMethodError in Users#new

undefined method `email' for #<User _id: BSON::ObjectId('4eb8cbcaef704c02da000017')>

Extracted source (around line #13):

10:       <tbody><tr>
11:         <td><%= f.label :email %>:</td>
12:         <td>
13:           <%= f.text_field :email, :placeholder => "your email address" %>
14:         </td>
15:       </tr>
16:       <tr>

In the console:

>> User.new.email
NoMethodError: undefined method `email' for #<User _id: BSON::ObjectId('4eb8cc4def704c0358000005')>
    from /Library/Ruby/Gems/1.8/gems/activemodel-3.1.1/lib/active_model/attribute_methods.rb:385:in `method_missing'
    from (irb):5

The model looks like: (note class User does not inherit from any Active Record super class… does this matter?)

class User
  include MongoMapper::Document

  attr_accessor :password
  attr_accessible :username, :email, :password

  email_regex = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i

  validates :username, :presence => true,
                   :format => { :with => /^[a-zA-Z][a-zA-Z0-9_]+$/ },
                   :length => { :maximum => 32, :minimum => 4 }
  validates :email, :presence => true,
                    :format => { :with => email_regex },
                    :uniqueness => { :case_sensitive => false }
  validates :password, :presence => true,
                       :length => { :within => 5..32 },
                       :confirmation => true
  (etc...)
  • 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-26T16:45:41+00:00Added an answer on May 26, 2026 at 4:45 pm

    If you look at the error messages you’ll see things like this:

    #<User _id: BSON::ObjectId('4eb8cc4def704c0358000005')>
    

    so your MongoMapper backed models only have the default _id property. You’ll need to tell MongoMapper what the other properties are:

    class User
      include MongoMapper::Document
    
      key :password, String
      key :username, String
      key :email, String
      #...
    

    The MongoMapper documentation can be difficult to navigate but the important bits are there.

    So MongoMapper does use schemas of a sort.

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

Sidebar

Related Questions

Just getting started with DB4O object oriented database. I'm very familiar with SQL, if
Just getting started with Linq to SQL so forgive the newbie question. I'm trying
Just getting started with db2. Quick question about giving it SQL commands from a
So I'm getting started learning Rails. Now that Rails 3 is out, I want
I'm just getting started on some programming to handle filenames with non-english names on
Getting started with jquery and having trouble getting hello world type example going for
Getting started with NHibernate How can I generate identity fields in nHibernate using Hilo
Getting started with TDD and I want to ground up a Repository-driven Model. However,
getting started with osgi, i wonder what's the conceptual diffence between bundles and components.
Just getting started using MVC in ASP.NET, I'm going to have it so users

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.