diff options
author | Mikel Lindsaar <raasdnil@gmail.com> | 2010-03-28 14:44:34 +1100 |
---|---|---|
committer | Mikel Lindsaar <raasdnil@gmail.com> | 2010-03-28 14:44:34 +1100 |
commit | 2bcc2ebf44b59e46c104c92d621e8051c97bfcf5 (patch) | |
tree | d2a3f04fd3020c1b5d88847af62d52f2d5e5bd61 /activemodel/lib/active_model/serializers | |
parent | f5774e3e3f70a3acfa559b9ff889e9417fb71d4b (diff) | |
parent | 8398f21880a952769ccd6437a4344922fe596dab (diff) | |
download | rails-2bcc2ebf44b59e46c104c92d621e8051c97bfcf5.tar.gz rails-2bcc2ebf44b59e46c104c92d621e8051c97bfcf5.tar.bz2 rails-2bcc2ebf44b59e46c104c92d621e8051c97bfcf5.zip |
Merge branch 'master' of git://github.com/rails/rails
Diffstat (limited to 'activemodel/lib/active_model/serializers')
-rw-r--r-- | activemodel/lib/active_model/serializers/xml.rb | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/activemodel/lib/active_model/serializers/xml.rb b/activemodel/lib/active_model/serializers/xml.rb index 86149f1e5f..c226359ea7 100644 --- a/activemodel/lib/active_model/serializers/xml.rb +++ b/activemodel/lib/active_model/serializers/xml.rb @@ -1,3 +1,4 @@ +require 'active_support/core_ext/array/wrap' require 'active_support/core_ext/class/attribute_accessors' require 'active_support/core_ext/hash/conversions' @@ -85,8 +86,8 @@ module ActiveModel @options[:except] = Array.wrap(@options[:except]).map { |n| n.to_s } end - # To replicate the behavior in ActiveRecord#attributes, - # <tt>:except</tt> takes precedence over <tt>:only</tt>. If <tt>:only</tt> is not set + # To replicate the behavior in ActiveRecord#attributes, <tt>:except</tt> + # takes precedence over <tt>:only</tt>. If <tt>:only</tt> is not set # for a N level model but is set for the N+1 level models, # then because <tt>:except</tt> is set to a default value, the second # level model can have both <tt>:except</tt> and <tt>:only</tt> set. So if @@ -108,7 +109,7 @@ module ActiveModel end def serializable_method_attributes - Array(options[:methods]).inject([]) do |methods, name| + Array.wrap(options[:methods]).inject([]) do |methods, name| methods << MethodAttribute.new(name.to_s, @serializable) if @serializable.respond_to?(name.to_s) methods end |