Reputation: 13
I'm new to Rails, and i'm connecting to a remote database. The connection is OK, but I'm getting the error:
Mysql2::Error: Table 'catalogo.productos' doesn't exist: SHOW FULL FIELDS FROM `productos`
I know that the table that I'm trying to access is Productos and no productos. I've tried to use:
class Productos < ActiveRecord::Base
establish_connection "catalogo"
set_table_name "Productos"
end
But I keep getting the error. What I need to do? I can't modify the name of the table, I only have SELECT permissions.
I'll show the controller where the error shows
require "Producto.rb"
class StoreController < ApplicationController
def index
Products = Producto.find(:all)
end
end
I'm using Rails 3.2.3 and Ruby 1.9.3. Thanks!
Upvotes: 1
Views: 780
Reputation: 6862
your model name should be singular. Change class Productos
to class Producto
class Producto < ActiveRecord::Base
establish_connection "catalogo"
set_table_name "Productos"
end
Upvotes: 1