Is there a way to provide parameters to .order in Rails? You can provide parameters to .where.
For example:
People.where("age > :min_age and age < :max_age", {:min_age => 20, :max_age: 80})
Doing this with .order translates differently to sql.
For example:
Places.order("pow(lat - :mylat,2) + pow(lon-:mylon,2)", {:mylat => 1, :mylon => 2})
translates into the following sql which gives a sql syntax error.
SELECT * FROM places ORDER BY pow(lat - :mylat,2) + pow(lon - :mylon,2) '---\n:mylat: 1\n:mylon: 2\n'
I know you can sort an array using .sort_by. I would like to know if you can do this using the .order function in Active Record.