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

Serialized methods that return nil should not be considered YAML #492

Merged
merged 1 commit into from May 10, 2011
Merged

Serialized methods that return nil should not be considered YAML #492

merged 1 commit into from May 10, 2011

Conversation

jaw6
Copy link
Contributor

@jaw6 jaw6 commented May 10, 2011

(Rebased version of #200 (commits))

The way ActiveModel computes the type of serializable methods and attributes, any that return nil will be described as being YAML.

This produces XML like:

<person>
  <name>John Doe</name>
  <preferences type="yaml" nil="true"></preferences>
</person>

However, in many cases, the 'type="yaml"' part is unnecessary, and potentially misleading.

With this patch, the equivalent to the above XML would be:

<person>
  <name>John Doe</name>
  <preferences nil="true"></preferences>
</person>

josevalim added a commit that referenced this pull request May 10, 2011
Serialized methods that return nil should not be considered YAML
@josevalim josevalim merged commit ceaf73a into rails:master May 10, 2011
matthewd pushed a commit that referenced this pull request Apr 24, 2018
rtyley pushed a commit to bfg-repo-cleaner-demos/rails-with-all-non-head-files-deleted that referenced this pull request Sep 11, 2023
This is a direct port of @jaw6's pull request
rails/rails#492. His cleanly applied to Rails
v3.1 and v3.2, and this cleanly applies to v3.0.

With yesterday's security patches
http://weblog.rubyonrails.org/2013/1/8/Rails-3-2-11-3-1-10-3-0-19-and-2-3-15-have-been-released/
there is now an issue with Rails v3.0 serving XML to any of the latest
versions of ActiveResource.

Without this, Rails v3.0 can serve XML to ActiveResource consumers that
will see `Hash::DisallowedType: Disallowed type attribute: "yaml"`
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.

None yet

2 participants