Module: GoldRecord::InstanceMethods
- Defined in:
- lib/gold_record/base.rb
Instance Method Summary collapse
Instance Method Details
#generate_id! ⇒ Object
30 31 32 |
# File 'lib/gold_record/base.rb', line 30 def generate_id! self[self.class.primary_key] ||= GoldRecord::UUID.random_generate end |
#to_param ⇒ Object
26 27 28 |
# File 'lib/gold_record/base.rb', line 26 def to_param (id = self.id) ? GoldRecord::UUID.encode_hex(id) : nil end |
#to_uuid ⇒ Object
22 23 24 |
# File 'lib/gold_record/base.rb', line 22 def to_uuid UUIDTools::UUID.parse_raw(id) rescue nil end |