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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T08:00:19+00:00 2026-06-07T08:00:19+00:00

I have module in /lib/models/scopes.rb module Models module Scopes extend ActiveSupport::Concern … end end

  • 0

I have module in /lib/models/scopes.rb

module Models
    module Scopes
        extend ActiveSupport::Concern
        ...
    end
end

I’m trying to include it from model:

class User < ActiveRecord::Base
  include Models::Scopes
end

And getting error:

NameError: uninitialized constant User::Models

How to solve this trouble? Maybe it`s wrong to keep this types of files in /lib?

Environment:
Rails v3.1
Ruby v1.9.3

  • 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-07T08:00:24+00:00Added an answer on June 7, 2026 at 8:00 am

    Rails doesn’t require files in the lib directory automatically, but you can add to the autoloaded paths in config/application.rb:

    config.autoload_paths += %W(#{config.root}/lib)
    

    Restart the server to pick up the new settings.

    This will now load the file automatically when the module name is first used. In development mode, you might want to reload the module after every change in order to see the changes without restarting the server. To do that, add it as an eager load path instead:

    config.eager_load_paths += %W(#{config.root}/lib)
    

    The scope shouldn’t be a problem as long as you don’t have a Models class or module within User or anywhere else.

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

Sidebar

Related Questions

Let's assume we have following models: from django.db import models class Foo(models.Model): name =
If you have: module A class B end end You can find B and
I have a model which can be attached to to other models. class Attachable(models.Model):
I have these models: class Projects(models.Model): projectName =models.CharField(max_length = 100,unique=True,db_index=True) projectManager = EmbeddedModelField('Users') class
I have a model project_phase : from django.db import models from django.utils import simplejson
I have the following routing configuration: entry: class: sfDoctrineRouteCollection options: model: ProjectEntry module: entry
I have the following code in my project`s lib directory module Pasta module ClassMethods
I have the following Django Model which retrieves 3 records from a database. The
I have the following structure: lib/models/module_name.rb lib/models/module_name/one.rb lib/models/module_name/two.rb lib/models/module_name/three.rb module_name.rb contains the following: require
I have a model named Promotion . class Promotion < ActiveRecord::Base; FORMATS = [0,1]

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.