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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T07:43:18+00:00 2026-05-18T07:43:18+00:00

When my system requires two classes or modules of the same name, what can

  • 0

When my system requires two classes or modules of the same name, what can I do to specify which I mean?

I’m using rails (new to it), and one of my models is named “Thread”. When I try to refer to the class “Thread” in thread_controller.rb, the system returns some other constant of the same name.

<thread.rb>
class Thread < ActiveRecord::Base

  def self.some_class_method
  end

end

<thread_controller.rb>
class ThreadController < ApplicationController

  def index
    require '../models/thread.rb'
    @threads = Thread.find :all
  end

end

When I try Thread.find(), I get an error saying that Thread has no method named find. When I access Thread.methods, I don’t find my some_class_method method among them.

Any help? (And don’t bother posting “just name your model something else.” It’s not helpful to point out obvious compromises.)

  • 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-18T07:43:19+00:00Added an answer on May 18, 2026 at 7:43 am

    You could put your app into its own namespace.

    <my_app/thread.rb>
    module MyApp
      class Thread
      end
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a two model classes which have relationship of one to many. public
We have a legacy system that requires a format which is not html but
I am writing a system which requires me to fetch the values of properties
I'm developing an API system which requires this type of authentication. The user will
I am developing a Django application, which is a large system that requires multiple
I'm developing an app which requires the system to get the touch events even
Well, I have a application which somehow requires some system resources, but how do
I have a system for a file hosting site which requires a PHP script
I am serializing objects to XML using System.Xml.Serialization and this requires me to have
I have two classes SccmAction and TicketAction which both implement interface IDelivery. These classes

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.