clarat-org / clarat

An Open Source Charity Directory
http://www.clarat.org/
MIT License
8 stars 10 forks source link

Filtern nach current_assignment.X produziert Serverfehler #1392

Closed NilsVollmer closed 6 years ago

NilsVollmer commented 6 years ago

Aus den Logs:

10 Oct 2017 17:06:58.147278 <190>1 2017-10-10T15:06:57.780858+00:00 app web.1 - - Started GET "/api/v1/divisions?filters%5Bcurrent-assignment.receiver-team.name%5D%5Bfirst%5D=T&filters%5Bcity.name%5D%5Bfirst%5D=Dortmund" for 78.52.172.29 at 2017-10-10 15:06:57 +0000
10 Oct 2017 17:06:58.147150 <190>1 2017-10-10T15:06:57.782415+00:00 app web.1 - - Processing by API::V1::DivisionsController#index as JSON
10 Oct 2017 17:06:58.147214 <190>1 2017-10-10T15:06:57.782447+00:00 app web.1 - - Parameters: {"filters"=>{"current-assignment.receiver-team.name"=>{"first"=>"T"}, "city.name"=>{"first"=>"Dortmund"}}}
10 Oct 2017 17:06:58.147158 <190>1 2017-10-10T15:06:57.790441+00:00 app web.1 - - Completed 500 Internal Server Error in 8ms (ActiveRecord: 1.1ms)
10 Oct 2017 17:06:58.14796 <190>1 2017-10-10T15:06:57.792239+00:00 app web.1 - -
10 Oct 2017 17:06:58.148267 <190>1 2017-10-10T15:06:57.792262+00:00 app web.1 - - ArgumentError (The association scope 'current_assignment' is instance dependent (the scope block takes an argument). Preloading instance dependent scopes is not supported.):
10 Oct 2017 17:06:58.14896 <190>1 2017-10-10T15:06:57.792276+00:00 app web.1 - -
10 Oct 2017 17:06:58.148151 <190>1 2017-10-10T15:06:57.792296+00:00 app web.1 - - app/concepts/api/v1/lib/jsonify_collection.rb:8:in `call'
10 Oct 2017 17:06:58.148152 <190>1 2017-10-10T15:06:57.792297+00:00 app web.1 - - app/controllers/api/v1/backend_controller.rb:14:in `index'

In der Konsole funktioniert der current_assignment-scope - der Bug tritt in jsonify_collection auf.

Z.B. zu reproduzieren mit folgendem request:

/api/v1/divisions?filters%5Bcurrent-assignment.receiver-team.name%5D%5Bfirst%5D=Screening
NilsVollmer commented 6 years ago

Als Hotfix direkt auf master umgesetzt & deployed.