提交 7eb110f1 编写于 作者: M Matthew Draper

Merge pull request #15677 from sgrif/sg-less-imperative-pk

Use a conditional rather than early return in `id`
......@@ -15,9 +15,10 @@ def to_key
# Returns the primary key value.
def id
return unless self.class.primary_key
sync_with_transaction_state
read_attribute(self.class.primary_key)
if pk = self.class.primary_key
sync_with_transaction_state
read_attribute(pk)
end
end
# Sets the primary key value.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册