active_model_serializers icon indicating copy to clipboard operation
active_model_serializers copied to clipboard

v. 0.9.5 not working with rails v6 and zeitwerk autoloading mode

Open hadiS opened this issue 3 years ago • 5 comments
trafficstars

Hi! Does anybody else have problems with active model serialisers v. 0.9.5 with zeitwerk autoloading mode in rails 6?

My serializers are being ignored completely. No errors or warnings are being thrown. But whenever I add them manually in my controllers like

render json: @user, serializer: UserSerializer

it works fine! Switching autoloading to classic mode works too.

When I downgrade ams to v. 0.8.5 it works too, hence serializers work fine again and are being found automatically in rails 6 with zeitwerk mode.

hadiS avatar Apr 01 '22 09:04 hadiS

0.8, 0.9, and 0.10 are more or less mutually incompatible. If you're on 0.9, I do not recommend trying to downgrade.

I'm happy to support a PR to make zeitwerk mode work.

bf4 avatar Apr 01 '22 21:04 bf4

@bf4 where is the solution am using ams v= 0.10.13?

myousry22 avatar Sep 01 '22 19:09 myousry22

Need a detailed bug report to have any hope of solving it

bf4 avatar Sep 02 '22 00:09 bf4

@bf4 Having the same issue with rails 6 zeitwerk loader (using v0.10.13). It will return error like:

NoMethodError:
  undefined method `model_name' for MyClass
  Did you mean?  module_parent

favechua avatar Jan 30 '23 08:01 favechua

Doesn't sound like a zeitwerk related issue to me, but can't tell without a detailed bug report @favechua

bf4 avatar Jan 30 '23 13:01 bf4