开发者

searchlogic returns nil when I order my records

开发者 https://www.devze.com 2023-01-05 21:38 出处:网络
I can\'t figure out why ascend_by won\'t wo开发者_JAVA百科rk for me.Here\'s a console readout >> tapes = Tape.search(:timestamp_gte => \"1278361923\")

I can't figure out why ascend_by won't wo开发者_JAVA百科rk for me. Here's a console readout

>> tapes = Tape.search(:timestamp_gte => "1278361923")

=> blah blah blah

>> tapes.length

=> 1436

>> tapes.ascend_by_timestamp

=> nil

I get the same behavior when I use descend_by and other columns.

ruby 1.8.7

Rails 2.3.8

searchlogic 2.4.19


Well, I'm not sure why, but it looks like it works if you add in the scope at the same time. But (oddly) only if the ascend part comes first. So:

tapes = Tape.ascend_by_id.search(:timestamp_gte => "1278361923")

should work, while

tapes = Tape.search(:timestamp_gte => "1278361923").ascend_by_id

doesn't.

0

精彩评论

暂无评论...
验证码 换一张
取 消