Sha256: 288f30804cb6c17521593e59328d087cf89830c4e0c6f7800480ac84161a965f

Contents?: true

Size: 357 Bytes

Versions: 2

Compression:

Stored size: 357 Bytes

Contents

module ActiveRecord::HintMethods
  def hint(index_hint_by_table)
    thread_index_hint_by_table = (Thread.current[Arel::Visitors::MySQL::INDEX_HINT_BY_TABLE_THREAD_KEY] ||= {}.with_indifferent_access)
    thread_index_hint_by_table.update(index_hint_by_table)
    self
  end
end

ActiveRecord::Relation.class_eval do
  include ActiveRecord::HintMethods
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
arel-mysql-index-hint-0.1.1 lib/arel-mysql-index-hint/active_record-hint_methods.rb
arel-mysql-index-hint-0.1.0 lib/arel-mysql-index-hint/active_record-hint_methods.rb