Skip to content

Commit

Permalink
Make activeadmin-mongoid 0.3.0 play nice with regular activerecord ac…
Browse files Browse the repository at this point in the history
…tiveadmin resources
  • Loading branch information
profmaad committed Jan 5, 2014
1 parent c2547d4 commit 47cae71
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/active_admin/mongoid/helpers/collection.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
module ActiveAdmin
module Helpers
module Collection

alias original_collection_size collection_size
original_collection_size = instance_method(:collection_size)
def collection_size(collection=collection)
collection.count(true)
if(not collection.empty? and collection.first.class.included_modules.include?(Mongoid::Document))
collection.count(true)
else
original_collection_size(collection)
end
end
end
end
Expand Down

0 comments on commit 47cae71

Please sign in to comment.