Hi,
I have an external (company)database with 2 tables depart, and
countries, wich i want to use in my rails-app.
Setup:
development (Local):
adapter: mysql
database: fly (tables > pages ect.)
username: root
password:
host: localhost
extern(company):
adapter: mysql
database: fly2 (tables > depart, countries)
username: root
password:
host: localhost
I created a depart model on my local sever
Class Depart < ActiveRecord ::Base
set_table_name = “depart”
establisch_connection :extern
end
This works fine from my console; looks like this
Page.connection.instance_eval{@config:database]}
“fly”
Depart.connection.instance_eval{@config:database]}
“fly2”
Because the tables depart, countries is on our central server i set the
Pluralization off by the “set_table_name”
Now i want to connect also to the countries table with the same
database-connection.
I have read that a creation of an external-class do the job
class External < ActiveRecord ::Base
establisch_connection :extern
end
class Depart < External
end
class Countries < External
end
Question: where i define my set_table_name for each class??
remco