Skip to content

Instantly share code, notes, and snippets.

@honorlin
Created October 18, 2014 16:08
Show Gist options
  • Save honorlin/d64f2c10f2ede72e0c43 to your computer and use it in GitHub Desktop.
Save honorlin/d64f2c10f2ede72e0c43 to your computer and use it in GitHub Desktop.
get_class_data
def self.get_class_data(keywords)
job = in_effect
condition = ""
keywords.each { |keyword| condition += with_contains_keyword(keyword)}
condition = condition[0 , condition.length - 3 ]
job.where(condition)
end
def self.with_contains_keyword(keyword)
"lower(job_info) LIKE '%#{keyword.downcase}%' or "
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment