Created
March 28, 2011 03:19
-
-
Save m3talsmith/889957 to your computer and use it in GitHub Desktop.
Like independent across mysql and postgres example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scope :with_name, lambda { |name| | |
case self.configurations[Rails.env]['adapter'] | |
when 'mysql' | |
where("name LIKE '%#{name}%'") | |
when 'postgresql' | |
where("lower(name) LIKE '%#{name.downcase}%'") | |
end | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment