I have a table named "tables" and inside there is a column named table_name. And, on my DB inside other schema I have this table. Like:
db: tables
id table_name other_attributes
1 minerals ...
2 animals ...
db: minerals
id name type
1 rock nil
2 sand nil
The tables doesn't have the same structure. I would like to call my model like:
> tab = Table.find(1)
> tab.elements.all
=> [ {id: 1, name: 'rock', type: nil}, {id: 2, name: 'sand', type: nil} ]
And use any kind of active record tasks inside this .elements... I didn't find any way and the closest article that I found was this: Rails 3/ActiveRecord: How to switch/change table name during request dynamically?
ActiveRecord::Base.connection.execute("SQL query")to just create the tables with manual SQL queries.