diff options
author | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-03-09 21:58:56 -0300 |
---|---|---|
committer | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-03-09 22:07:59 -0300 |
commit | 3508da50f02b11290245976f2dbaeef6cd794e83 (patch) | |
tree | f8a7f10e55640c2e97a552cf76dc0b380393c214 | |
parent | 3d04d726fde4352795204f819ff4821f8991f42e (diff) | |
download | rails-3508da50f02b11290245976f2dbaeef6cd794e83.tar.gz rails-3508da50f02b11290245976f2dbaeef6cd794e83.tar.bz2 rails-3508da50f02b11290245976f2dbaeef6cd794e83.zip |
Rename variable to avoid using name "include"
Better syntax highlight :)
-rw-r--r-- | activemodel/lib/active_model/serialization.rb | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/activemodel/lib/active_model/serialization.rb b/activemodel/lib/active_model/serialization.rb index 866659e6fd..4323ee1e09 100644 --- a/activemodel/lib/active_model/serialization.rb +++ b/activemodel/lib/active_model/serialization.rb @@ -9,7 +9,6 @@ module ActiveModel # A minimal implementation could be: # # class Person - # # include ActiveModel::Serialization # # attr_accessor :name @@ -17,7 +16,6 @@ module ActiveModel # def attributes # {'name' => nil} # end - # # end # # Which would provide you with: @@ -41,7 +39,6 @@ module ActiveModel # So a minimal implementation including XML and JSON would be: # # class Person - # # include ActiveModel::Serializers::JSON # include ActiveModel::Serializers::Xml # @@ -50,7 +47,6 @@ module ActiveModel # def attributes # {'name' => nil} # end - # # end # # Which would provide you with: @@ -124,13 +120,13 @@ module ActiveModel # +records+ - the association record(s) to be serialized # +opts+ - options for the association records def serializable_add_includes(options = {}) #:nodoc: - return unless include = options[:include] + return unless includes = options[:include] - unless include.is_a?(Hash) - include = Hash[Array(include).map { |n| n.is_a?(Hash) ? n.to_a.first : [n, {}] }] + unless includes.is_a?(Hash) + includes = Hash[Array(includes).map { |n| n.is_a?(Hash) ? n.to_a.first : [n, {}] }] end - include.each do |association, opts| + includes.each do |association, opts| if records = send(association) yield association, records, opts end |