views:

60

answers:

1

Imagine a code:

search = Project.search(
  :title_or_description_or_child_name_or_child_age_or_inspiration_or_decorating_style_or_favorite_item_or_others_like_any => keys,
  :galleries_id_like_any => @g,
  :styles_id_like_any => @st,
  :tags_like_any => @t
)

search.all returns the rows correctly.

But search.descend_by_views returns nil.

Is this gem buggy? What else should I use then?

+1  A: 

I'm not sure why it's not working with search.descend_by_views but this should work:

search = Post.descend_by_views.search(
  :title => ...
  ...
)

Instead of search, you could also use scopes for everything else too:

Post.title_or_anything_like_any(keys).galleries_id_like_any(@g)...descend_by_views.all
Tomas Markauskas
Yes this works! thanks!
jaycode