Also known as the question <"The user has many databases." →
Wednesday
My application looks like this:
user has_many databases
database has_many tables
table has_many rows
row habtm(+value) columns
you get the idea!
Therefore, instead of modeling the database inside the database, I would like to:
- The sqlite3 database in which users are stored, and
- many sqlite databases for each user
Each user will LCRUD his tables in their databases (similar to phpmyadmin)
Problem
I would like to have a thread-safe configuration for each request database connection and table_name
class Table < ActiveRecord::Base
end
Table.connection = current_user.session.connection
Table.table_name = params[:table_name]
@rows = Table.all
, , , , . , 2 2 .
?