File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
lib/active_admin/resource_controller
spec/unit/resource_controller Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -128,7 +128,7 @@ def build_resource
128
128
#
129
129
# @return [ActiveRecord::Base] An un-saved active record base object
130
130
def build_new_resource
131
- scoped_collection . send (
131
+ apply_authorization_scope ( scoped_collection ) . send (
132
132
method_for_build ,
133
133
*resource_params . map { |params | params . slice ( active_admin_config . resource_class . inheritance_column ) }
134
134
)
Original file line number Diff line number Diff line change 225
225
it "should assign nested attributes once" do
226
226
expect ( subject . posts . size ) . to eq ( 1 )
227
227
end
228
+
229
+ context "given authorization scope" do
230
+ let ( :authorization ) { controller . send ( :active_admin_authorization ) }
231
+
232
+ it "should apply authorization scope" do
233
+ expect ( authorization ) . to receive ( :scope_collection ) do |collection |
234
+ collection . where ( age : "42" )
235
+ end
236
+ expect ( subject . age ) . to eq ( 42 )
237
+ end
238
+ end
228
239
end
229
240
end
You can’t perform that action at this time.
0 commit comments