Skip to content
This repository
Browse code

Use Array.wrap

  • Loading branch information...
commit 706f31323162ab8bdc5b10180bcd2740c0c9b6c3 1 parent f58c322
Jeremy Kemper jeremy authored

Showing 1 changed file with 4 additions and 4 deletions. Show diff stats Hide diff stats

  1. +4 4 activerecord/lib/active_record/serialization.rb
8 activerecord/lib/active_record/serialization.rb
@@ -20,9 +20,9 @@ def serializable_attribute_names
20 20
21 21 if options[:only]
22 22 options.delete(:except)
23   - attribute_names = attribute_names & Array(options[:only]).collect { |n| n.to_s }
  23 + attribute_names = attribute_names & Array.wrap(options[:only]).collect { |n| n.to_s }
24 24 else
25   - options[:except] = Array(options[:except]) | Array(@record.class.inheritance_column)
  25 + options[:except] = Array.wrap(options[:except]) | Array.wrap(@record.class.inheritance_column)
26 26 attribute_names = attribute_names - options[:except].collect { |n| n.to_s }
27 27 end
28 28
@@ -30,7 +30,7 @@ def serializable_attribute_names
30 30 end
31 31
32 32 def serializable_method_names
33   - Array(options[:methods]).inject([]) do |method_attributes, name|
  33 + Array.wrap(options[:methods]).inject([]) do |method_attributes, name|
34 34 method_attributes << name if @record.respond_to?(name.to_s)
35 35 method_attributes
36 36 end
@@ -51,7 +51,7 @@ def add_includes(&block)
51 51 :only => options[:only] }
52 52
53 53 include_has_options = include_associations.is_a?(Hash)
54   - associations = include_has_options ? include_associations.keys : Array(include_associations)
  54 + associations = include_has_options ? include_associations.keys : Array.wrap(include_associations)
55 55
56 56 for association in associations
57 57 records = case @record.class.reflect_on_association(association).macro

0 comments on commit 706f313

Please sign in to comment.
Something went wrong with that request. Please try again.