Monday, August 21, 2006

LIKE as a condition to get records.

Here's a handy tip for Rails beginners: When you need to find records based on a condition that involves the use of LIKE '%value%' (it's going to be very slow since MySQL won't use an index for this query), try something like the following:

 @records = MyModel.find(:all, :conditions => ['col LIKE ? ', '%'+@term+'%'],:limit => 10)

2 Comments:

At 10:19 PM, Blogger Shanmukha Katta said...

Good..I got corre correct solution.

 
At 10:03 PM, Blogger Selfless said...

The sequel to MapleStory, the popular side-scrolling 2D online role-playing game, maplestory 2 mesos for sale is finally coming to regions beyond South Korea.

MapleStory 2, which publisher Nexon America showed off Saturday in Los Angeles at the fan event MapleStory Fest, ditches the pixelated 2D visuals of the first game for a blocky 3D world, à la Minecraft or even Trove. Its course process is not as varied as that of the original game yet, Maplestory M mesos but Nexon said in a news release that MapleStory two will be quite customizable, from your outfits to even getting to construct your own home.

 

Post a Comment

<< Home

eXTReMe Tracker