Ruby on Rails
Friday, May 25, 2012
Hi,
Here is my problem. I store some of my data in a MYSQL DB and some of it in Redis. In my search I need to be able to combine results from both.
Right now my code looks like this:
scope = User.scoped({})
cope = scope.where("users.gender = ?", gender)
cope = scope.where("users.age = ?", age)
etc..
I want to take the result and either sort it using the data that's in Redis. It is possible do create a scope for that?
The best I could come up with was users = User.search().sort_by {|user| ...} . The problem with is is that it returns an array instead of an active record associations, so now pagination doesn't work.
Regards,
Eugene
-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/5iZ1L1G1haIJ.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment