Module: Utils
- Extended by:
- ActiveSupport::Concern
- Defined in:
- app/models/concerns/utils.rb
Instance Method Summary collapse
- #obj_type ⇒ Object
- #reindex(_anything) ⇒ Object
- #sanitize(text) ⇒ Object
- #sanitize_content ⇒ Object
- #sanitize_description ⇒ Object
Instance Method Details
#obj_type ⇒ Object
6 7 8 |
# File 'app/models/concerns/utils.rb', line 6 def obj_type self.class.name end |
#reindex(_anything) ⇒ Object
28 29 30 |
# File 'app/models/concerns/utils.rb', line 28 def reindex(_anything) index! if persisted? end |
#sanitize(text) ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'app/models/concerns/utils.rb', line 10 def sanitize(text) ActionController::Base.helpers.sanitize( text, = { tags: %w[p br h1 h2 h3 a strong em u s sub sup span img iframe pre blockquote ul li ol], attributes: %w[height width style src href rel target class allowfullscreen frameborder data-value data-index data-denotation-char data-link] } ) end |
#sanitize_content ⇒ Object
24 25 26 |
# File 'app/models/concerns/utils.rb', line 24 def sanitize_content self.content = sanitize(content) end |
#sanitize_description ⇒ Object
20 21 22 |
# File 'app/models/concerns/utils.rb', line 20 def sanitize_description self.description = sanitize(description) end |