File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -171,7 +171,7 @@ def view_query
171
171
def execute_query
172
172
query = build_query ( )
173
173
@results = @model . find_by_sql ( [ query , @bind_variables ] ) # Execute Sql Query
174
- @results = @results . first if @single_record # Return a single result if requested
174
+ @results = @single_record ? @ results. first : @results
175
175
176
176
determine_count ( )
177
177
preload_associations ( )
@@ -250,16 +250,18 @@ def determine_count
250
250
end
251
251
252
252
def load_associations
253
- @results = Associations . load_associations (
254
- payload : @results ,
253
+ result = Associations . load_associations (
254
+ payload : Array ( @results ) ,
255
255
associations : @associations ,
256
256
as_json_options : @as_json_options
257
257
)
258
+
259
+ @results = @single_record ? result . first : result
258
260
end
259
261
260
262
def preload_associations
261
263
Associations . preload_associations (
262
- payload : @results ,
264
+ payload : Array ( @results ) ,
263
265
preload : @preload
264
266
)
265
267
end
You can’t perform that action at this time.
0 commit comments