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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T17:14:40+00:00 2026-05-28T17:14:40+00:00

I have a Ruby on Rails project that has been untouched for a while,

  • 0

I have a Ruby on Rails project that has been untouched for a while, and I’m in the process of trying to upgrade it from Rails 2.0 to 3.1.

I’m getting an error when I try and instantiate one of the models. It seems as though one of the models is also defined somewhere as a module, and this is stopping me from instantiating it.

dgs@dgs-desktop ~/code/spelling $ rails c
Loading development environment (Rails 3.1.1)
ree-1.8.7-head :001 > Spelling.first
NoMethodError: undefined method `first' for Spelling:Module
    from (irb):1
ree-1.8.7-head :002 > exit

The spelling class is very basic:

class Spelling < ActiveRecord::Base
  belongs_to :word, :class_name => 'Word', :foreign_key => 'word_id'
end

I can’t find where in the app (which is pretty small) this module would be defined:

dgs@dgs-desktop ~/code/spelling $ cd app
dgs@dgs-desktop ~/code/spelling/app $ grep Spelling * -R
models/spelling.rb:class Spelling < ActiveRecord::Base
models/word.rb:   has_many :spellings, :class_name => 'Spelling', :foreign_key => 'word_id'
models/spelling_user.rb:class SpellingUser < ActiveRecord::Base
views/layouts/application.html.erb:  <title> School Spelling Tests</title>

dgs@dgs-desktop ~/code/spelling/app $ find ./ -name "spelling*"
./views/spellings
./views/admin/spellings
./models/spelling.rb
./models/spelling_user.rb

Does anyone know what could be causing this? Or how else I could track down where this module is being defined?

  • 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-28T17:14:41+00:00Added an answer on May 28, 2026 at 5:14 pm

    So . . . . after much hunting round in completely the wrong place, I found the (obvious) answer.

    dgs@dgs-desktop /tmp/spelling $ cat config/application.rb 
    require File.expand_path('../boot', __FILE__)
    
    require 'rails/all'
    
    module Spelling
      class Application < Rails::Application
      ...
      end 
    end
    

    Somewhere along the upgrade from rails 2.x to rails 3.1 the application name becomes a module. As I had a model with the same name as the application, this model failed.

    (I had seen this line in application.rb show up during my greps, but discounted it)

    The rest of the application worked fine, it was only when I reached something depending on this model that it was failing. When I copied the entire application bit by bit into a temporary application (called spelling_new) everything worked, so decided it must have been some cruft in the original application and renamed spelling_new -> spelling. At this point everything blew up again and the culprit became clear.

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

Sidebar

Related Questions

I currently have a Ruby on Rails project that has CarrierWave running on it.
Hello Ruby/Rails/Merb developers! Im currently working on a web project that will have a
I have been trying to get a ruby on rails app going on my
I have a Ruby on Rails application that has two active environments, Stage and
I'm using Ruby on Rails to populate a database from a form that has
This is the error I'm getting: Task not supported by 'mysql2' /Users/me/.rvm/gems/ruby-1.8.7-p352@project/gems/rails-2.3.8/lib/tasks/databases.rake:380 Here is
This is not a ruby/rails project deploy. I have the following situation and I
I am building a ruby on rails project. it is a portal. I have
I do have experience with Ruby on Rails, and am programming a project in
I have an existing project written in Ruby on Rails. It is sort of

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.