mardi 19 juillet 2016

Can we use multiple tables(created on fly) for a single model in rails?

I have a model TempUser that is used for data crunching using lots of queries to narrow down the result. Its a replica of User Model. For narrowing down the result it copies the all the records from users_table into temp_users_table and keeps deleting record according to filters applied on it so that in the end I only have filtered users in TempUser model where I can perform more active record operations on the residual data.

I am trying to make dynamic tables for TempUser Model so that If more than one user request for TempUser Model then he should have different temp_user_dynamic_table to perform operations on it. Is it possible?

something like:-

class TempUser < ActiveRecord::Base
end

which has multiple dynamic tables created on fly when new request comes in like:- temp_users_table1,temp_users_table2

Aucun commentaire:

Enregistrer un commentaire