Module: Pageflow::AutoGeneratedPermaId
- Extended by:
- ActiveSupport::Concern
- Included in:
- Page
- Defined in:
- app/models/concerns/pageflow/auto_generated_perma_id.rb
Overview
Add a perma_id
attribute of type integer. The perma_id is automatically generated on create and remains unchanged throughout the models lifecycle.
Instance Method Summary collapse
Instance Method Details
#ensure_perma_id ⇒ Object
12 13 14 |
# File 'app/models/concerns/pageflow/auto_generated_perma_id.rb', line 12 def ensure_perma_id self.perma_id ||= (self.class.maximum(:perma_id) || 0) + 1 end |