diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2011-12-07 15:35:27 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-12-07 15:35:27 -0800 |
commit | 1fc47a1a8438905b7097ce14a538d3209aa4a25c (patch) | |
tree | ddaff2661b835e974949f6dfad885316d2be8ed1 /activerecord | |
parent | 85237842657132e8fe34bd460d3db2adee077d37 (diff) | |
download | rails-1fc47a1a8438905b7097ce14a538d3209aa4a25c.tar.gz rails-1fc47a1a8438905b7097ce14a538d3209aa4a25c.tar.bz2 rails-1fc47a1a8438905b7097ce14a538d3209aa4a25c.zip |
stop calling String#to_s so frequently
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb b/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb index 6f135b56b5..eb67e96705 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb @@ -86,7 +86,8 @@ module ActiveRecord # Returns a ColumnDefinition for the column with name +name+. def [](name) - @columns.find {|column| column.name.to_s == name.to_s} + name = name.to_s + @columns.find { |column| column.name == name } end # Instantiates a new column for the table. @@ -224,7 +225,7 @@ module ActiveRecord # t.references :taggable, :polymorphic => { :default => 'Photo' } # end def column(name, type, options = {}) - column = self[name] || ColumnDefinition.new(@base, name, type) + column = self[name] || ColumnDefinition.new(@base, name.to_s, type) if options[:limit] column.limit = options[:limit] elsif native[type.to_sym].is_a?(Hash) @@ -455,7 +456,7 @@ module ActiveRecord column_names = args # column_names = args # column_names.each do |name| # column_names.each do |name| - column = ColumnDefinition.new(@base, name, '#{column_type}') # column = ColumnDefinition.new(@base, name, 'string') + column = ColumnDefinition.new(@base, name.to_s, '#{column_type}') # column = ColumnDefinition.new(@base, name, 'string') if options[:limit] # if options[:limit] column.limit = options[:limit] # column.limit = options[:limit] elsif native['#{column_type}'.to_sym].is_a?(Hash) # elsif native['string'.to_sym].is_a?(Hash) |