Permalink
Browse files

Use Array.wrap

  • Loading branch information...
1 parent f58c322 commit 706f31323162ab8bdc5b10180bcd2740c0c9b6c3 @jeremy jeremy committed Apr 27, 2009
Showing with 4 additions and 4 deletions.
  1. +4 −4 activerecord/lib/active_record/serialization.rb
@@ -20,17 +20,17 @@ def serializable_attribute_names
if options[:only]
options.delete(:except)
- attribute_names = attribute_names & Array(options[:only]).collect { |n| n.to_s }
+ attribute_names = attribute_names & Array.wrap(options[:only]).collect { |n| n.to_s }
else
- options[:except] = Array(options[:except]) | Array(@record.class.inheritance_column)
+ options[:except] = Array.wrap(options[:except]) | Array.wrap(@record.class.inheritance_column)
attribute_names = attribute_names - options[:except].collect { |n| n.to_s }
end
attribute_names
end
def serializable_method_names
- Array(options[:methods]).inject([]) do |method_attributes, name|
+ Array.wrap(options[:methods]).inject([]) do |method_attributes, name|
method_attributes << name if @record.respond_to?(name.to_s)
method_attributes
end
@@ -51,7 +51,7 @@ def add_includes(&block)
:only => options[:only] }
include_has_options = include_associations.is_a?(Hash)
- associations = include_has_options ? include_associations.keys : Array(include_associations)
+ associations = include_has_options ? include_associations.keys : Array.wrap(include_associations)
for association in associations
records = case @record.class.reflect_on_association(association).macro

0 comments on commit 706f313

Please sign in to comment.