Skip to content

Commit

Permalink
Merge pull request #15677 from sgrif/sg-less-imperative-pk
Browse files Browse the repository at this point in the history
Use a conditional rather than early return in `id`
  • Loading branch information
matthewd committed Jun 13, 2014
2 parents 86bbfbc + 607e335 commit 7eb110f
Showing 1 changed file with 4 additions and 3 deletions.
Expand Up @@ -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.
Expand Down

0 comments on commit 7eb110f

Please sign in to comment.