From: Martin Robertson Date: 2007-11-12T13:37:58+09:00 Subject: Re: newbie stuck with multiple conditions Hi Jacob I have tried what you have suggested @listings = ListingDetail.find(:all, :conditions => ["suburb_id = ? AND bedroom_id = ? AND garage_id = ?", params[:suburb_id], params [:bedroom_id], params[:garage_id]]) but it throws up errors as app/controllers/admin/listing_details_controller.rb:55: syntax error, unexpected tLBRACK, expecting ']' [:bedroom_id], params[:garage_id]]) ^ app/controllers/admin/listing_details_controller.rb:55: syntax error, unexpected ',', expecting kEND [:bedroom_id], params[:garage_id]]) ^ app/controllers/admin/listing_details_controller.rb:55: syntax error, unexpected ']', expecting kEND [:bedroom_id], params[:garage_id]]) ^ app/controllers/admin/listing_details_controller.rb:85: syntax error, unexpected $end, expecting kEND I have also tried a variation of this def results suburb_id=params[:suburb][:id] bedroom_id=params[:bedroom][:id] garage_id=params[:garage][:id] @listings=ListingDetail.find( :all, :conditions =>["suburb_id =:suburb_id and bedroom_id=:bedroom_id and garage_id=:garage_id", { :suburb_id =>suburb_id, :bedroom_id=>bedroom_id, :garage_id=>garage_id } ] ) end this produces error message Showing app/views/admin/listing_details/results.rhtml where line #2 raised: You have a nil object when you didn't expect it! You might have expected an instance of Array. The error occurred while evaluating nil.each Extracted source (around line #2): 1: RAILS_ROOT: ./script/../config/.. (--deleted all this stuff--) Request Parameters: {"garage"=>{"id"=>"1"}, "commit"=>"Search", "suburb"=>{"id"=>"2"}, "bedroom"=>{"id"=>"1"}} I have also posted this as new post in correct rails forum as advised Martin -- Posted via http://www.ruby-forum.com/.