Skip to content

Commit

Permalink
Prevent extra sync_with_transaction_state
Browse files Browse the repository at this point in the history
`sync_with_transaction_state` in `to_key` is unneeded because `id` also
does.
  • Loading branch information
kamipo committed Jun 14, 2017
1 parent b812885 commit f5f7ca5
Showing 1 changed file with 2 additions and 5 deletions.
Expand Up @@ -8,17 +8,14 @@ module PrimaryKey
# Returns this record's primary key value wrapped in an array if one is
# available.
def to_key
sync_with_transaction_state
key = id
[key] if key
end

# Returns the primary key value.
def id
if pk = self.class.primary_key
sync_with_transaction_state
_read_attribute(pk)
end
sync_with_transaction_state
_read_attribute(self.class.primary_key) if self.class.primary_key
end

# Sets the primary key value.
Expand Down

0 comments on commit f5f7ca5

Please sign in to comment.