Paginator order_by

I would like to use the paginator helper to order by a quantity that is
the product of two database columns.

Is there a simple way to do this?

Alan C. wrote:

I would like to use the paginator helper to order by a quantity that is
the product of two database columns.

Is there a simple way to do this?

Someone will correct me if I’m wrong, but by using simple SQL you should
be able to do…

:order => “(col1 * col2)”

I’m also assuming that by product you mean multiplication. You can of
course do any simple maths, or even other SQL queries in here.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs