Skip to content

Instantly share code, notes, and snippets.

@ahe
Created January 5, 2010 15:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ahe/269456 to your computer and use it in GitHub Desktop.
Save ahe/269456 to your computer and use it in GitHub Desktop.
Article.all(:conditions => { 'title' => { '$exists' => true }, 'description' => { '$exists' => true },
'$where' => "this.title.match(/#{params[:keyword]}/i) || this.description.match(/#{params[:keyword]}/i)"})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment