我是 Rails 新手,我正在连接到远程数据库。连接正常,但出现错误:
Mysql2::Error: Table 'catalogo.productos' doesn't exist: SHOW FULL FIELDS FROM `productos`
我知道我要访问的表是 Productos 而不是 productos。我试过使用:
class Productos < ActiveRecord::Base
establish_connection "catalogo"
set_table_name "Productos"
end
但我不断收到错误。我需要做什么?我不能修改表的名称,我只有 SELECT 权限。
我将向控制器显示错误显示的位置
require "Producto.rb"
class StoreController < ApplicationController
def index
Products = Producto.find(:all)
end
end
我正在使用 Rails 3.2.3 和 Ruby 1.9.3。谢谢!