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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:39:03+00:00 2026-05-27T00:39:03+00:00

I had some issues with a different ODM yesterday so I decided to take

  • 0

I had some issues with a different ODM yesterday so I decided to take a look at Mongoid instead. The wiki tutorial was pretty thorough, so it seemed like it was worth a shot. I went through the wiki article very carefully but may have missed something. Perhaps this is happening because I had a different ODM in the app yesterday. Anyway, now I’m getting an error:

uninitialized constant User::Mongoid

with this line of code (threw this in to confirm it was this method that was the issue):

<% if user_signed_in? -%>
5:     Hello user
6:     <% end -%>

user_signed_in is a Devise method. I suspect that Devise isn’t actually loading but I’m not sure what to do next.

My gem file has gem "devise", "1.5.0" and I’ve run a bundler install, I can see that devise is getting installed. I’ve confirmed that my application controller exactly matches the app controller in the sample. My app starts with no issues when I run rails server. All the models in the app load correctly when I do load 'app/models/user.rb'. The file config/initializers/devise.rb has require 'devise/orm/mongoid'. I’ve verified that my User model exactly matches the one in the tutorial.

What should I look at next?

Update: This was fixed, but I’m still missing how. I started the app on a new port. That’s all it took. I was making changes to my index.html.erb and seeing those changes in the error that I was getting so I know the new code was being seen. But when I started the app on a new port the error went away. Perhaps there’s some sort of ‘hard recompile’ in rails that I’m not aware of?

  • 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-27T00:39:04+00:00Added an answer on May 27, 2026 at 12:39 am

    First, confirm that the error is still happening after you fully restart your rails instance.

    I suppose that in the User model you have something like this:

    class User
      include Mongoid::Document
    
      devise :database_authenticatable, ...
    end
    

    Check in config/initializers/devise.rb:

      # ==> ORM configuration
      # Load and configure the ORM. Supports :active_record (default) and
      # :mongoid (bson_ext recommended) by default. Other ORMs may be
      # available as additional gems.
      require 'devise/orm/mongoid'
    

    Also check that devise gem is under mongoid gem in Gemfile:

    gem "mongoid", "~> 2.3.2"
    gem "bson_ext"
    gem "devise", "~> 1.4.9"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So basically this code was working fine before. I had some computer issues and
We recently had some issues where a sql script that would remove duplicate entries
So, we had a little ETL app that had some issues with updates. Which
I've recently had some issues implementing a zooming feature into a painting application. Please
I had some time this afternoon to run a head to head comparison between
I had some site templates designed for me recently. I got the final HTML
I had some problems with my subversion server and i had to restore it
I had some code that ran commands through Runtime.getRuntime.exec(String) , and it worked on
I had some questions regarding the structure and behavior of a model, using UML,
I had some decryption code (using wincrypt.h ) that lived within my FileReader.cpp class.

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.