diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2012-01-19 14:39:13 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2012-01-19 14:39:13 -0800 |
commit | 642752c54dd953f18a0f876964c93ee0e8e9a52a (patch) | |
tree | f77e47b999edb42f7a9a1d6fcb98a04b8af8731b /activerecord/lib | |
parent | 8129a09589bce7f13ded9b465d29e16eaa1d86bf (diff) | |
download | rails-642752c54dd953f18a0f876964c93ee0e8e9a52a.tar.gz rails-642752c54dd953f18a0f876964c93ee0e8e9a52a.tar.bz2 rails-642752c54dd953f18a0f876964c93ee0e8e9a52a.zip |
avoid useless is_a checks
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb index e6ddf8bf8f..dbfb375ba8 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb @@ -171,15 +171,15 @@ module ActiveRecord # Extracts the value from a PostgreSQL column default definition. def self.extract_value_from_default(default) + # This is a performance optimization for Ruby 1.9.2 in development. + # If the value is nil, we return nil straight away without checking + # the regular expressions. If we check each regular expression, + # Regexp#=== will call NilClass#to_str, which will trigger + # method_missing (defined by whiny nil in ActiveSupport) which + # makes this method very very slow. + return default unless default + case default - # This is a performance optimization for Ruby 1.9.2 in development. - # If the value is nil, we return nil straight away without checking - # the regular expressions. If we check each regular expression, - # Regexp#=== will call NilClass#to_str, which will trigger - # method_missing (defined by whiny nil in ActiveSupport) which - # makes this method very very slow. - when NilClass - nil # Numeric types when /\A\(?(-?\d+(\.\d*)?\)?)\z/ $1 |