Module: ActiveIndex::Core::ClassMethods

Defined in:
lib/active_index/core.rb

Instance Method Summary collapse

Instance Method Details

#find_with_index(*args) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/active_index/core.rb', line 5

def find_with_index(*args)
  args_dup = args.dup

  case args.first
  when Symbol
    h = args.second
  else
    h = nil
  end

  if h && (h[:index])
    index_option = h.delete(:index)
    args_dup.second.merge!(:from => "`#{table_name}` USE INDEX `#{index_name_for(index_option)}`")
  else
  end

  find_without_index(*args_dup)
end