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

Improve decorator serialization #448

Merged
merged 2 commits into from
Jan 31, 2013
Merged

Improve decorator serialization #448

merged 2 commits into from
Jan 31, 2013

Conversation

haines
Copy link
Contributor

@haines haines commented Jan 31, 2013

  • Only serialize the attributes implemented by the decorator.
  • Add to_xml and as_json methods, because although we have implemented serializable_hash, the methods that use it will fall through to the model and so it will never be called.

steveklabnik added a commit that referenced this pull request Jan 31, 2013
Improve decorator serialization
@steveklabnik steveklabnik merged commit 75dcfd7 into drapergem:master Jan 31, 2013
@steveklabnik
Copy link
Member

Seems legit. Thank you.

@haines haines deleted the attributes branch January 31, 2013 22:52
@thedeeno
Copy link

@haines Is it just my setup or are you noticing that json serialization is including root by default? IIRC, this is supposed to be turned off when ActiveModel::Serializers::JSON is included. Adding self.include_root_in_json = false to my decorators resolves the problem - but I shouldn't need to.

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

Successfully merging this pull request may close these issues.

4 participants