Class: SpudPagePartial
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- SpudPagePartial
- Defined in:
- app/models/spud_page_partial.rb
Instance Method Summary collapse
- #content_processed ⇒ Object
- #maintain_revisions ⇒ Object
- #symbol_name ⇒ Object
- #update_symbol_name ⇒ Object
Instance Method Details
#content_processed ⇒ Object
15 16 17 18 |
# File 'app/models/spud_page_partial.rb', line 15 def content_processed ActiveSupport::Deprecation.warn('#content_processed is deprecated; use #content instead.') content end |
#maintain_revisions ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'app/models/spud_page_partial.rb', line 20 def maintain_revisions return true unless changed.include?('content') revision = SpudPagePartialRevision.new(spud_page_id: spud_page_id, name: name, format: format, content: content) revision.save if Spud::Cms.max_revisions > 0 revision_count = SpudPagePartialRevision.where(spud_page_id: spud_page_id, name: name).count if revision_count > Spud::Cms.max_revisions revision_bye = SpudPagePartialRevision.where(spud_page_id: spud_page_id, name: name).order('created_at ASC').first revision_bye.destroy unless revision_bye.blank? end end return true end |
#symbol_name ⇒ Object
11 12 13 |
# File 'app/models/spud_page_partial.rb', line 11 def symbol_name return @symbol_name || name.parameterize.underscore end |
#update_symbol_name ⇒ Object
7 8 9 |
# File 'app/models/spud_page_partial.rb', line 7 def update_symbol_name self.symbol_name = name.parameterize.underscore end |