diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2019-02-21 01:59:43 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-21 01:59:43 +0900 |
commit | dfa857ef25b5abf7485e4f7115e4a311e00c599c (patch) | |
tree | aa5e16c17dc13dd5af358d1973ccf3c8fd229ab6 /activerecord/lib/active_record | |
parent | 5b756f4342d2b48a0dccb6d7aa48bcb3f0048e84 (diff) | |
parent | 6735a0719d43b08a18bb5ea544ad2af0935138a5 (diff) | |
download | rails-dfa857ef25b5abf7485e4f7115e4a311e00c599c.tar.gz rails-dfa857ef25b5abf7485e4f7115e4a311e00c599c.tar.bz2 rails-dfa857ef25b5abf7485e4f7115e4a311e00c599c.zip |
Merge pull request #35263 from hatch-carl/reduce-postgres-uuid-allocations
Reduce unused allocations when casting UUIDs for Postgres
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/postgresql/oid/uuid.rb | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/oid/uuid.rb b/activerecord/lib/active_record/connection_adapters/postgresql/oid/uuid.rb index bc9b8dbfcf..28abdbd073 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/oid/uuid.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/oid/uuid.rb @@ -13,9 +13,12 @@ module ActiveRecord :uuid end - def cast(value) - value.to_s[ACCEPTABLE_UUID, 0] - end + private + + def cast_value(value) + casted = value.to_s + casted if casted.match?(ACCEPTABLE_UUID) + end end end end |