active_model_serializers
active_model_serializers copied to clipboard
Deprecation warning when using ActiveModel::SerializableResource.new does not specify alternative
Message:
NOTE: ActiveModel::SerializableResource.new is deprecated; use ActiveModelSerializers::SerializableResource. instead
Expected behavior vs actual behavior
Expected behavior: The deprecation message should Indicate what the new/replacement method is. Actual behavior: The new method is omitted
(guessing it should read: ActiveModelSerializers::SerializableResource.new)
Steps to reproduce
Call ActiveModel::SerializableResource.new
Environment
ActiveModelSerializers Version: 0.10.7
Output of ruby -e "puts RUBY_DESCRIPTION":
ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-darwin16]
OS Type & Version: MacOS 10.12.6
Integrated application and version (e.g., Rails, Grape, etc): Rails 5.1.4
Sorry for delayed response. I hope this could help someone who has this same problem.
As far as I concerned, you can use the new method , if I'm not misintrepreting what it's pointed in the docs . If you have an instance already, personally I've used initialize() method.
Hope it helps. Cheers!
yeah, it should read ActiveModelSerializers::SerializableResource.new
@juliolugo96 new is a class method initialize is an instance method (called by the class method new on the return value of the class method allocate)
@bf4 That's right. Thanks for the clarification, I'll update my comment.