mumuki/mumuki-domain

View on GitHub
app/models/concerns/with_case_insensitive_search.rb

Summary

Maintainability
A
0 mins
Test Coverage
module WithCaseInsensitiveSearch
  extend ActiveSupport::Concern

  included do
    scope :find_by_ignore_case!, lambda { |attribute, value| where("lower(#{attribute}) = ?", value.downcase).first! }
  end
end