I had the following in searchlogic:

Todo.contact_id_is(self.id).ascend_by_original_date.done_date_not_null.first

How would I do this in metawhere now that I am in Rails 3? In particular the not_null and the sorting?

Hello, I'm a little confused. When I look at the named scopes found in meta_search (instead of metawhere)...that's more of what I'm looking for...and now metasearch is being replaced with ransack....

What is the way to do chained searches with sql on my models in the way searchlogic made it so drop-dead easy?

...okay...now it looks like ransack is for forms, but queries on models is squeel? Checking that out....

有帮助吗?

解决方案

It seems that metawhere doesn't have != operator it was added in sqeel so here is a possible workaround

Todo.where( { :contact_id => self.id} ).order( :original_date.asc ).where( '"todos"."done_date" NOT NULL' ).first
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top