Permalink
Browse files

Added table name to clear out "ambiguous column name bug" when sortin…

…g joint tables.
  • Loading branch information...
1 parent 1f3526d commit b336e60323e1e1f4a5b7f0503e52129f9437cd62 Benoit Bénézech committed May 5, 2011
Showing with 1 addition and 0 deletions.
  1. +1 −0 lib/rails_admin/adapters/active_record.rb
@@ -144,6 +144,7 @@ def model_store_exists?
def merge_order(options)
@sort ||= options.delete(:sort) || "id"
+ @sort = (@sort.to_s.include?('.') ? @sort : "#{model.table_name}.#{@sort}")
@sort_order ||= options.delete(:sort_reverse) ? "asc" : "desc"
options.merge(:order => "#{@sort} #{@sort_order}")
end

0 comments on commit b336e60

Please sign in to comment.