Class: Proclaim::Post
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Proclaim::Post
- Extended by:
- FriendlyId
- Includes:
- AASM
- Defined in:
- app/models/proclaim/post.rb
Instance Attribute Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#excerpt_length ⇒ Object
55 56 57 |
# File 'app/models/proclaim/post.rb', line 55 def excerpt_length @excerpt_length ||= Proclaim.excerpt_length end |
Instance Method Details
#excerpt ⇒ Object
59 60 61 62 63 64 65 66 67 |
# File 'app/models/proclaim/post.rb', line 59 def excerpt document = Nokogiri::HTML.fragment(body) unless document.text.empty? takeExcerptOf first_block_element_text(document) else "" end end |
#feature_image ⇒ Object
78 79 80 81 82 83 84 85 86 |
# File 'app/models/proclaim/post.rb', line 78 def feature_image document = Nokogiri::HTML.fragment(body) return nil if document.children.empty? first_element_images = document.children.first.css("img") return nil if first_element_images.empty? return first_element_images.first.attr "src" end |
#notifyPostSubscribers(newComment) ⇒ Object
69 70 71 72 73 74 75 76 |
# File 'app/models/proclaim/post.rb', line 69 def notifyPostSubscribers(newComment) subscriptions.each do | subscription | # Don't notify the commenter of own comment if subscription.comment_id != newComment.id subscription.deliver_new_comment_notification_email(newComment) end end end |