Skip to content

Commit d0db736

Browse files
committed
Mock some AR::Relation methods about tables
1 parent bf6c296 commit d0db736

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

lib/active_admin/mongoid/criteria.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
require 'delegate'
2+
13
Mongoid::Criteria.class_eval do
24
def relation *args, &block
35
self
@@ -6,5 +8,15 @@ def relation *args, &block
68
def base
79
klass
810
end
11+
12+
def table
13+
CollectionTable.new(klass.collection)
14+
end
15+
16+
class CollectionTable < SimpleDelegator
17+
def from(*a)
18+
self
19+
end
20+
end
921
end
1022

0 commit comments

Comments
 (0)