File tree Expand file tree Collapse file tree 2 files changed +4
-5
lines changed Expand file tree Collapse file tree 2 files changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ def self.scope(*scope_names)
29
29
delegate :total_count , :total_pages , to : :objects
30
30
31
31
def initialize ( objects , options = { } )
32
- options . assert_valid_keys ( :with )
32
+ options . assert_valid_keys ( :with , :scope )
33
33
34
34
@objects = objects
35
35
@drop_class_name = options [ :with ]
Original file line number Diff line number Diff line change @@ -39,14 +39,13 @@ def self.drop_class_for(resource)
39
39
end
40
40
41
41
# Create a drop instance when it cannot be inferred.
42
- def self . dropify ( resource , options = { } )
43
- binding . pry
42
+ def self . dropify ( wealth , options = { } )
44
43
drop_class = if options [ :class_name ]
45
44
options [ :class_name ] . constantize
46
45
else
47
- drop_class_for ( resource )
46
+ drop_class_for ( wealth )
48
47
end
49
- # eval "resource .#{options[:scope]}"
48
+ resource = options [ :scope ] . nil? ? wealth : eval ( "wealth .#{ options [ :scope ] } ")
50
49
drop_class . new ( resource , options . except ( :class_name ) )
51
50
end
52
51
You can’t perform that action at this time.
0 commit comments