Skip to content

Instantly share code, notes, and snippets.

Created January 25, 2012 16:36
Show Gist options
  • Save anonymous/1677114 to your computer and use it in GitHub Desktop.
Save anonymous/1677114 to your computer and use it in GitHub Desktop.
syntax error
class Student < ActiveRecord::Base
# def self.search(search)
# search_condition = "%" + search + "%"
# find(:all, :conditions => ['student_name LIKE ?', search_condition])
#end
def self.search(search)
where("student_name LIKE ?", "%#{search}%").all
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment