Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weird deprecation warning #195

Closed
JIucToyxuu opened this issue Sep 2, 2016 · 1 comment
Closed

Weird deprecation warning #195

JIucToyxuu opened this issue Sep 2, 2016 · 1 comment

Comments

@JIucToyxuu
Copy link

I'm use representable(version 2.5) and this throws the deprecation warning:
[Representable] Mixing user and representable options is deprecated. Please provide your options via :user_options.
This happened when I' use #to_json method. I do short detective research code and see strange situation. Maybe this should be as is, but see really strange.

  1. begin from call this - https://github.com/apotonick/representable/blob/v2.4.1/lib/representable/json.rb#L43-L45;
  2. this will call #to_hash - https://github.com/apotonick/representable/blob/v2.4.1/lib/representable/hash.rb#L33-L40;
  3. in process of execution, #to_hash will call method which will add _self parameter -https://github.com/apotonick/representable/blob/v2.4.1/lib/representable/hash/collection.rb#L22-L30;
  4. for this call #Serialize method - https://github.com/apotonick/representable/blob/v2.4.1/lib/representable/serializer.rb#L38-L45;
  5. result of call #Serialize - again call #to_hash, but with options which contain _self parameter.

So, this trigger deprecation warning - https://github.com/apotonick/representable/blob/v2.4.1/lib/representable/deprecations.rb#L13-L14

@apotonick
Copy link
Member

Hey, it's best to upgrade to 3.0 (which should be working without any code changes for you!) since the deprecations are a bit hairy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants