railsadminteam / rails_admin

RailsAdmin is a Rails engine that provides an easy-to-use interface for managing your data
MIT License
7.9k stars 2.26k forks source link

If a string is specified in sort_by, do not prefix table name or apply sort order #1889

Open chrisbloom7 opened 10 years ago

chrisbloom7 commented 10 years ago

As mentioned in my comment on #1667, if a string (or ultimately anything but a symbol representing a column) is specified for sort_by, RA should not automatically prefix a table name to the column or apply a sort order, but should append it to the query as-is.

This would allow for these examples, which currently fail with a SQL error:

rails_admin do
  list do
    sort_by "lower(name)"
    sort_reverse false
  end
end

or

rails_admin do
  list do
    sort_by "family.name ASC, name DESC"
    sort_reverse false
  end
altV commented 7 years ago

any workarounds? :)

chrisbloom7 commented 7 years ago

3.75 years later?!?! LOL, I can't remember if I found a work around. Sorry :(

jfrux commented 6 years ago

No way to fix this? What a nightmare lol