Skip to content

Commit

Permalink
fix album search
Browse files Browse the repository at this point in the history
  • Loading branch information
Arthur PETRY committed Oct 21, 2011
1 parent 7de2bc6 commit e074322
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions app/controllers/albums_controller.rb
Expand Up @@ -3,9 +3,7 @@ class AlbumsController < ApplicationController
def index
conditions = {}
if q = params[:q]
# conditions = {:artist => /#{q}/i, :name => /#{q}/i}
# see http://www.mongodb.org/display/DOCS/OR+operations+in+query+expressions
conditions = { "$where" => "this.name.match(/#{q}/i) || this.artist.match(/#{q}/i)" }
conditions = { '$or' => [ {"name" => /#{q}/i}, {'artist' => /#{q}/i} ] }
end
if params[:randomly]
@albums = Album.find_randomly
Expand Down

0 comments on commit e074322

Please sign in to comment.