Class: MagicScopes::StringScopesGenerator
Instance Method Summary
collapse
#by, #by_desc
#eq, #ne, #with, #without
#initialize, instance
Instance Method Details
#ilike(name) ⇒ Object
15
16
17
|
# File 'lib/magic_scopes/scopes_generators/string.rb', line 15
def ilike(name)
scope name || "#{@attr}_ilike", ilike_scope
end
|
#like(name) ⇒ Object
7
8
9
|
# File 'lib/magic_scopes/scopes_generators/string.rb', line 7
def like(name)
scope name || "#{@attr}_like", ->(*vals) { where(build_query(*vals, "#{@key} LIKE ?", 'OR')) }
end
|
#not_ilike(name) ⇒ Object
19
20
21
|
# File 'lib/magic_scopes/scopes_generators/string.rb', line 19
def not_ilike(name)
scope name || "#{@attr}_not_ilike", ilike_scope('NOT')
end
|
#not_like(name) ⇒ Object
11
12
13
|
# File 'lib/magic_scopes/scopes_generators/string.rb', line 11
def not_like(name)
scope name || "#{@attr}_not_like", ->(*vals) { where(build_query(*vals, "#{@key} NOT LIKE ?", 'AND')) }
end
|