Hi,
due to the legacy nature of my database I have to do a set_table_name() to make sure that the correct MySQL table is picked up by the AR model.
For example:
model.set_table_name(params[:use_this_table])
One thing that occurred to me is that if I have multiple users accessing my app and they're looking at different tables then I run the risk that one user's set_table_name might over-write another's leading to incorrect data being sent to the user.
To mitigate the problem I do the set_table_name as close as possible to the find() or where I write to the database.
Is this a valid concern? Are there more techniques to prevent this happening or even detect that it happens?
Thanks,
Allan