Skip to content
Snippets Groups Projects
Commit 44f9efaa authored by Arnaud Levy's avatar Arnaud Levy
Browse files

rough migration

parent e755e826
No related branches found
No related tags found
No related merge requests found
......@@ -60,6 +60,8 @@ class Communication::Website::Post < ApplicationRecord
before_validation :set_published_at, if: :published_changed?
before_validation :summernote
scope :published, -> { where(published: true) }
scope :ordered, -> { order(published_at: :desc, created_at: :desc) }
scope :recent, -> { order(published_at: :desc).limit(5) }
......@@ -105,4 +107,8 @@ class Communication::Website::Post < ApplicationRecord
def inherited_blob_ids
[best_featured_image&.blob_id]
end
def summernote
self.text_new = self.text.to_s.gsub('<div>', '<p>').gsub('</div>', '</p>').gsub('<p><br></p>', '')
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment