Table_name question

Hello all!

I want to dynamically change table name for some count of my models.
I understand that may be it's bad practice but I simply need it.

I found some solution that works for somebody:

  around_filter :scope_rubrics_partition

  def scope_rubrics_partition
    Rubric.scope_rubrics_partition do

class Rubric < ActiveRecord::Base
  def self.scope_rubrics_partition
      if true
        set_table_name 'dp_ru_rubrics'
        # set_primary_key ''
        set_table_name 'rubrics'
       set_table_name 'rubrics'

Also patch rails to don't memoize table_name
      def table_name

      def quoted_table_name

But now I get an error like:

Mysql::Error: Unknown column '' in 'order clause': SELECT
`dp_ru_rubrics`.* FROM `dp_ru_rubrics` ORDER BY rubrics.`id` ASC
LIMIT 0, 15

So, how in the end set table name dynamically in production mode too?
Thank you!
p.s: sorry for poor english)