Skip to content

Commit

Permalink
Memoize global-id instead of creating objects every time.
Browse files Browse the repository at this point in the history
  • Loading branch information
larrylv committed May 20, 2014
1 parent 0d7a750 commit 25cab12
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/active_model/global_identification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ module GlobalIdentification
extend ActiveSupport::Concern

def global_id
GlobalID.create(self)
@global_id ||= GlobalID.create(self)
end
alias gid global_id

def signed_global_id
SignedGlobalID.create(self)
@signed_global_id ||= SignedGlobalID.create(self)
end
alias sgid signed_global_id
end
end
end

0 comments on commit 25cab12

Please sign in to comment.