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

  • Home
  • SEARCH
  • 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 5977147
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T21:19:44+00:00 2026-05-22T21:19:44+00:00

I have a module stat that exists in the directory structure: lib/stat_creator/stat/ In lib/stat_creator/stat.rb

  • 0

I have a module stat that exists in the directory structure: lib/stat_creator/stat/

In lib/stat_creator/stat.rb I have the files in the lib/stat_creator/stat/ directory that I require, as well as:

module StatCreator
    module Stat
    end
end

When I use that module I refer to the classes as

StatCreator::Stat::Foo.new 

Now I want a root Stat class that lives in app. I’ve made my Stat class in app/models and set it up in routes.rb. But if I go to rails console and try to use the Stat class in app/models like:

Stat.by_user_id("ID")

I get the error: LoadError: Expected ../lib/stat_creator/stat.rb to define Stat

I thought the point of using namespaces was to avoid this kind of conflict, so I don’t understand what I”m doing wrong.

  • 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-22T21:19:45+00:00Added an answer on May 22, 2026 at 9:19 pm

    I’d do:

    ::Stat.by_user_id("ID")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have module application. When I run it, the main window of that app
I have module that implements custom content type via NodeAPI hooks ( hook_insert ,
I have a module in the parent directory of my script and I would
I have a module that sends an email to a specified email address but
I have a module that reads the StandardError of a process. Everything works fine,
Let's say that I have a module that has a Queue in it. For
For example we have: module X def test X end end module Y def
I have a module Routines.pm: package Routines; use strict; use Exporter; sub load_shortest_path_matrices {
I have a module that I load it by Kernel when my application starts
i have written a library with some classes that make use of qt object

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.