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

Support JSON.mapping better #44

Open
waterlink opened this issue Mar 30, 2016 · 1 comment
Open

Support JSON.mapping better #44

waterlink opened this issue Mar 30, 2016 · 1 comment

Comments

@waterlink
Copy link
Owner

Currently, JSON.mapping overrides .new({ ... => ... }) constructor with its own.

Workaround for now is to do:

class Post < ActiveRecord::Model
  # ...

  def initialize(h : Hash)
    super(h)
  end

  JSON.mapping({ ... })
end
@waterlink
Copy link
Owner Author

This actually will still not work. Since JSON.mapping expects mapped fields to be in @<field_name>, but they are in @typed_fields[<field type>][<field name>] at the moment.

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

1 participant