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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T11:51:13+00:00 2026-05-30T11:51:13+00:00

Using Rails 3, I’ve changed the name of a table in the model like

  • 0

Using Rails 3, I’ve changed the name of a table in the model like this:

# app/models/product.rb
class Product < ActiveRecord::Base
  set_table_name "items"
end

But when I try setting up tests, I get the following error:

Started
E
Finished in 0.027396 seconds.

  1) Error:
test_the_truth(CustomerTest):
ActiveRecord::StatementInvalid: Mysql2::Error: Table 'project2_test.products' doesn't exist: DELETE FROM `products`


1 tests, 0 assertions, 0 failures, 1 errors

Any idea how I can let it know about Products?

  • 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-30T11:51:14+00:00Added an answer on May 30, 2026 at 11:51 am

    OK found the answer here:

    http://www.missiondata.com/blog/systems-integration/80/rails-fixtures-with-models-using-set_table_name/

    Had to change the name of the Fixture yml file from Products to Items.

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

Sidebar

Related Questions

Im using Rails 3.0.3 I have a Model Bill: class Bill < ActiveRecord::Base has_many
I am using Rails 2.3.5. Class User < ActiveRecord::Base has_many :phones end class Phone
Using Rails, I would like to add: <span class='req'>&bull;</span> within my <label> tags in
using rails 2.3.8. I'm getting this: [ [0] 0, [1] { name => Section,
Using Rails 3.2.0 with haml and sass: I Would like to link an external
Using Rails I'm trying to get an error message like The song field can't
Note: Using Rails 3.1 and current delayed_job gem. I have a User model that
Using Rails 3.1.3 with Devise 1.5.3. My app has accounts and users. Each account
Using Rails 3, I have an account model which has_many addresses. In the address
Using Rails 2.3.14, I'm looking for way to access the owner of an ActiveRecord

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.