Permalink
Browse files

Rename variable to avoid using name "include"

Better syntax highlight :)
  • Loading branch information...
carlosantoniodasilva committed Mar 10, 2012
1 parent 3d04d72 commit 3508da50f02b11290245976f2dbaeef6cd794e83
Showing with 4 additions and 8 deletions.
  1. +4 −8 activemodel/lib/active_model/serialization.rb
@@ -9,15 +9,13 @@ module ActiveModel
# A minimal implementation could be:
#
# class Person
- #
# include ActiveModel::Serialization
#
# attr_accessor :name
#
# 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 @@ def serializable_hash(options = nil)
# +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

0 comments on commit 3508da5

Please sign in to comment.