Module: MadID::IdentityMethods
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/mad_id/identity_methods.rb
Defined Under Namespace
Modules: UrlMethods
Instance Method Summary collapse
- #identifier ⇒ Object
- #identifier=(value) ⇒ Object
- #set_identifier ⇒ Object
- #short_identifier ⇒ Object
Instance Method Details
#identifier ⇒ Object
33 34 35 |
# File 'lib/mad_id/identity_methods.rb', line 33 def identifier read_attribute(self.class.mad_id_column) end |
#identifier=(value) ⇒ Object
29 30 31 |
# File 'lib/mad_id/identity_methods.rb', line 29 def identifier=(value) write_attribute(self.class.mad_id_column, value) end |
#set_identifier ⇒ Object
21 22 23 |
# File 'lib/mad_id/identity_methods.rb', line 21 def set_identifier self.identifier = "#{self.class.object_identifier_prefix}-#{SecureRandom.uuid}"[0..34].downcase end |
#short_identifier ⇒ Object
25 26 27 |
# File 'lib/mad_id/identity_methods.rb', line 25 def short_identifier self.identifier[0..11] end |