Skip to content

Commit

Permalink
Merge remote-tracking branch 'jpmckinney/master'
Browse files Browse the repository at this point in the history
fixes #13
  • Loading branch information
elia committed Jul 5, 2012
2 parents d3d05ee + 023c14b commit 005881f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
1 change: 1 addition & 0 deletions lib/active_admin/mongoid.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require 'active_admin'
require 'mongoid'

module ActiveAdmin
module Mongoid
Expand Down
2 changes: 0 additions & 2 deletions lib/active_admin/mongoid/document.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
require 'mongoid'

module ActiveAdmin::Mongoid::Document
extend ActiveSupport::Concern

Expand Down
8 changes: 3 additions & 5 deletions lib/active_admin/mongoid/resource.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
require 'active_admin'
require 'inherited_resources'

ActiveAdmin::Resource # autoload
class ActiveAdmin::Resource
def resource_table_name
Expand All @@ -14,15 +11,16 @@ class ActiveAdmin::ResourceController

protected

# @todo remove once https://github.com/gregbell/active_admin/pull/1454 is merged
def skip_sidebar!
@skip_sidebar = true
end

# Use #desc and #asc for sorting.
def sort_order(chain)
params[:order] ||= active_admin_config.sort_order
table_name = active_admin_config.resource_table_name
if params[:order] && params[:order] =~ /^([\w\_\.]+)_(desc|asc)$/
# @todo remove once https://github.com/mongoid/mongoid/pull/2175 is fixed
if params[:order] && params[:order] != 'id_desc' && params[:order] =~ /^([\w\_\.]+)_(desc|asc)$/
chain.send($2, $1)
else
chain # just return the chain
Expand Down

0 comments on commit 005881f

Please sign in to comment.