-2

Ok. So I've taken a decent sized data dump in the form of an sql script and imported it directly into my rails database without involving rails. Now I have noticed that the tables that were made in my database don't follow the the rails convention. I've already created the model files manually, but i'm not sure what to write into them. Here's a small list of the tables i have using the SHOW TABLES; command.

| mapLocationScenes                    |
| mapLocationWormholeClasses           |
| mapRegionJumps                       |
| mapRegions                           |
| mapSolarSystemJumps                  |
| mapSolarSystems                      |
| mapUniverse                          |
| planetSchematics                     |
| planetSchematicsPinMap               |
| planetSchematicsTypeMap              |
| ramActivities                        |
| ramAssemblyLineStations              |
| ramAssemblyLineTypeDetailPerCategory |
| ramAssemblyLineTypeDetailPerGroup    |
| ramAssemblyLineTypes                 |
| ramInstallationTypeContents          |
| schema_migrations                    |
| skinLicense                          |
| skinMaterials                        |
| skinShip                             |
| skins                                |
| staOperationServices                 |
| staOperations                        |
| staServices                          |
| staStationTypes                      |
| staStations                          |
| translationTables                    |
| trnTranslationColumns                |
| trnTranslationLanguages              |
| trnTranslations                      |
| users                                |
| warCombatZoneSystems                 |
| warCombatZones                       |
+--------------------------------------+

schema.rb

ActiveRecord::Schema.define(version: 20150505190032) do

  create_table "makeusers", force: :cascade do |t|
    t.string   "username"
    t.string   "password"
    t.boolean  "admin"
    t.string   "daisplayname"
    t.string   "email"
    t.integer  "dob"
    t.datetime "created_at",   null: false
    t.datetime "updated_at",   null: false
  end

  create_table "users", force: :cascade do |t|
    t.string   "email",                  default: "", null: false
    t.string   "encrypted_password",     default: "", null: false
    t.string   "reset_password_token"
    t.datetime "reset_password_sent_at"
    t.datetime "remember_created_at"
    t.integer  "sign_in_count",          default: 0,  null: false
    t.datetime "current_sign_in_at"
    t.datetime "last_sign_in_at"
    t.string   "current_sign_in_ip"
    t.string   "last_sign_in_ip"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.string   "name"
    t.string   "gamename"
    t.integer  "role"
  end

  add_index "users", ["email"], name: "index_users_on_email", unique: true
  add_index "users", ["reset_password_token"], name:  "index_users_on_reset_password_token", unique: true

end
Drew
  • 13
  • 7

1 Answers1

2

You can set the table name explicitly, when the name doesn't follow Rails' conventions. Example:

class MapSolarSystemJump < ActiveRecord::Base
  self.table_name = "mapSolarSystemJumps"
end

See table_name= in the docs.

spickermann
  • 100,941
  • 9
  • 101
  • 131