Gistflow

  • login

arel

A SQL algebra for #ruby.

https://github.com/rails/arel

History
Show

How to use scope definitions in another query? by releu

757fb0d5ec7560b6f25f5bd98eadc020?size=52

In my case I have a model Product has_one Location

The Location have a scope :near, lambda(coordinate, distance) { #... }.

I want to use near scope in this query:

Product.where(...).joins(:location)

More under the cut

April 16, 2012
Tweet
0

About

Join gistflow developers community

  • Start your developer blog in a minute.
  • Share code-related posts.
  • Follow users, subscribe for tags.
  • Use gist.github.com gists to write posts.

Sign up through GitHub

Tell friends about us

Tags

  • #ruby
  • #rails
  • #gistflow
  • #javascript
  • #activerecord
  • #gem
  • #bash
  • #git
  • #mac
  • #html
  • #shell
  • #coffeescript
  • #rspec
  • #github
  • #capistrano
  • Posts leaderboard
  • Tags cloud
  • Create issue
  • Email us
<g>

© 2013 Gistflow with Evrone