Question

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....

Was it helpful?

Solution

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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top