Module: Polivalente::ContentHashable
- Extended by:
- ActiveSupport::Concern
- Included in:
- Comment
- Defined in:
- app/models/concerns/polivalente/content_hashable.rb
Instance Method Summary collapse
Instance Method Details
#compute_content_hash ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/models/concerns/polivalente/content_hashable.rb', line 15 def compute_content_hash rich_text = ActionText::RichText.find_by(:record => self) if self.new_record? self[self.class.content_hash_column] = self.send(self.class.content_field).to_s.hash else if rich_text.nil? self[self.class.content_hash_column] = self[self.class.content_field].to_s.hash else self[self.class.content_hash_column] = rich_text.body.to_s.hash end end end |