Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/diaspora/diaspora.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRaphael Sofaer <raphael@joindiaspora.com>2011-06-14 03:31:40 +0400
committerRaphael Sofaer <raphael@joindiaspora.com>2011-06-14 03:31:40 +0400
commit7171aa05ed017e173b641b863390c5e71aa8c8ae (patch)
treea2aa25d628e212208f03052b02e6c1d685185e21 /lib
parent4815482354988b5c9661a6677e73a9c409a74cf6 (diff)
Do a little bit more documenting.
Diffstat (limited to 'lib')
-rw-r--r--lib/diaspora/guid.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/diaspora/guid.rb b/lib/diaspora/guid.rb
index 728752434..7ea870152 100644
--- a/lib/diaspora/guid.rb
+++ b/lib/diaspora/guid.rb
@@ -1,10 +1,13 @@
module Diaspora::Guid
+ # Creates a before_create callback which calls #set_guid and makes the guid serialize in to_xml
def self.included(model)
model.class_eval do
before_create :set_guid
xml_attr :guid
end
end
+
+ # @return [String] The model's guid.
def set_guid
self.guid ||= ActiveSupport::SecureRandom.hex(8)
end