To find all the movies made by a particular director, I have this in my controller. @dvd_pages, @dvds = paginate :dvds, :per_page => 10, :conditions => ['match(director) against (?)', params[:id].gsub('-',' ')] My db is mysql. The problem with the above is that this finds both Steven Spielberg and Steven Soderberg when searching for either one. ie a URL like http://mysite.com/director/steven-spielberg gets translated to SELECT * FROM dvds WHERE (match(director) against ('Steven Spielberg'))" when what I need is SELECT * FROM dvds WHERE (match(director) against ('"Steven Spielberg"')) ie the double quotes around the phrase that I am trying to match exactly. Where do I put the double quotes in my controller.rb? I tried around the ? and several other options but none works. Can anyone help?
on 2007-01-17 20:50
on 2007-01-18 00:44
Here's a workaround that did it for me: First set up dq_pattern = '"' + params[:id] + '"' and then use dq_pattern where params[:id] was used I'd like to hear if there are any other/better methods.