Class: ActiveRecord::Reflection::AssociationReflection
- Inherits:
-
MacroReflection
- Object
- MacroReflection
- ActiveRecord::Reflection::AssociationReflection
- Defined in:
- lib/db_charmer/active_record/reflection.rb
Instance Method Summary collapse
Instance Method Details
#quoted_table_name ⇒ Object
9 10 11 12 |
# File 'lib/db_charmer/active_record/reflection.rb', line 9 def quoted_table_name klass.switch_connection_to(klass.db_charmer_allocated_shard_connection[:config]) if sharded_reflection? @quoted_table_name = klass.quoted_table_name end |
#sharded_reflection? ⇒ Boolean
14 15 16 17 18 19 20 |
# File 'lib/db_charmer/active_record/reflection.rb', line 14 def sharded_reflection? # TODO: put this logic in WF if klass.db_charmer_allocated_shard_connection && klass.respond_to?(:db_charmer_extended) && klass.db_charmer_extended return true; end return false end |
#table_name ⇒ Object
4 5 6 7 |
# File 'lib/db_charmer/active_record/reflection.rb', line 4 def table_name klass.switch_connection_to(klass.db_charmer_allocated_shard_connection[:config]) if sharded_reflection? @table_name = klass.table_name end |