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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:42:22+00:00 2026-05-27T13:42:22+00:00

FIXED BY: changing model names to match rails naming conventions I’m getting the following

  • 0

FIXED BY:
changing model names to match rails naming conventions

I’m getting the following error when I try to join a skill to a user:

 irb(main):006:0> user.skills << skill
NameError: uninitialized constant Users::Skill
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.1.3/lib/active_r
ecord/base.rb:1341:in `compute_type'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.1.3/lib/active_r
ecord/reflection.rb:173:in `klass'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.1.3/lib/active_r
ecord/associations/collection_association.rb:146:in `transaction'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.1.3/lib/active_r
ecord/associations/collection_association.rb:124:in `concat'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.1.3/lib/active_r
ecord/associations/collection_proxy.rb:118:in `<<'
        from (irb):6
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/comman
ds/console.rb:45:in `start'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/comman
ds/console.rb:8:in `start'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/comman
ds.rb:40:in `<top (required)>'
        from script/rails:6:in `require'
        from script/rails:6:in `<main>'
irb(main):007:0>

Here is my users.rb file:

class Users < ActiveRecord::Base

    has_and_belongs_to_many :skills

end

Here is my skills.rb file:

class Skills < ActiveRecord::Base

    has_and_belongs_to_many :users

end

And here is my schema.rb file:

ActiveRecord::Schema.define(:version => 20111214152402) do

  create_table "skills", :force => true do |t|
    t.integer  "user_id"
    t.string   "description", :null => false
    t.string   "skill_name",  :null => false
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  add_index "skills", ["user_id"], :name => "index_skills_on_user_id"

  create_table "users", :force => true do |t|
    t.integer  "skill_id"
    t.string   "first_name",   :limit => 25
    t.string   "last_name",    :limit => 50
    t.string   "email",                       :default => ""
    t.string   "password",     :limit => 40
    t.string   "location",     :limit => 100
    t.string   "status"
    t.text     "bio"
    t.string   "question1"
    t.string   "question2"
    t.string   "availability"
    t.string   "image"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  add_index "users", ["skill_id"], :name => "index_users_on_skill_id"

  create_table "users_skills", :id => false, :force => true do |t|
    t.integer "user_id"
    t.integer "page_id"
  end

  add_index "users_skills", ["user_id", "page_id"], :name => "index_users_skills_on_user_id_and_page_id"

end

If you can help that’d be awesome! If you need to see other files let me know.

  • 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-27T13:42:22+00:00Added an answer on May 27, 2026 at 1:42 pm

    user.skills is an array so in order to add a skill, you need to do

    user.skills << skill

    Additionally, on your schema, I notice that your user_skils table contains wrong foreign key id. I believe they should be user_id and skill_id.

    Update

    Your users table also looks wrong. You do not need a skill_id in your users table. Similarly, you do not need user_id in your skills table.

    This is a small diagram of how the tables and attributes should look like

    users            skills_users         skills
    id      ---->    user_id
                     skill_id        ---> id
    

    Update 2

    Your model name looks wrong. It is a convention in RoR to use singular model name. Users should be User. Similarly, for skills.

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

Sidebar

Related Questions

I fixed an endless loop by changing Integer to int in the following: public
The following Java design allows an object to be extended without changing its interface
Is there a way of changing the Fixed Keyword Query in the search results
I'm changing a vector to a list. Ive fixed all the errors except these
Looking for confirmation or a correction on the following behaviour... When problematically changing width
consider the following: http://jsfiddle.net/PxabT/10/ There are 3 divs hd, bd, ft. hd is fixed
Fixed: See notes at bottom I am implementing a generic class that supports two
By fixed vector I mean a static list of values, like 1 through 24.
So I just fixed a bug in a framework I'm developing. The pseudo-pseudocode looks
I want to create fixed status bar in by web form to display various

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.