Class: Arel::SelectManager

Inherits:
Object
  • Object
show all
Defined in:
lib/case_insensitive_arel.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#project_with_case_insensitive(*things) ⇒ Object

We don’t want an attribute in the SELECT to be processed by the conversion proc. As such, tag project‘s’ parameters with a special singleton method to prevent them from being converted.



65
66
67
68
69
70
71
72
# File 'lib/case_insensitive_arel.rb', line 65

def project_with_case_insensitive(*things)
  # If a +thing+ is used elsewhere (e.g. in the WHERE clause), tagging it will cause the WHERE clause to be affected as well. So create a new
  # list of things and tag them instead.
  new_things = things.map do |thing|
    case_insensitive_thing thing
  end
  project_without_case_insensitive *new_things
end