Class: Comment
- Inherits:
-
Flareshow::Resource
- Object
- Flareshow::Resource
- Comment
- Extended by:
- Flareshow::Searchable
- Defined in:
- lib/comment.rb
Instance Method Summary collapse
- #content ⇒ Object
-
#files ⇒ Object
persisted files for this post.
-
#permalink(mobile = false) ⇒ Object
permalink to this comment.
-
#post ⇒ Object
get the post for this comment.
-
#user ⇒ Object
user for this post.
Methods included from Flareshow::Searchable
Methods inherited from Flareshow::Resource
#cache, cache_response, #changes, create, default_params, #destroy, #destroyed?, find, first, #get, get_from_cache, #id, #initialize, list_cache, #method_missing, #method_name, #refresh, #resource_key, resource_key, #save, #set, store, #update
Constructor Details
This class inherits a constructor from Flareshow::Resource
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Flareshow::Resource
Instance Method Details
#content ⇒ Object
36 37 38 |
# File 'lib/comment.rb', line 36 def content Nokogiri::HTML::Document.new.fragment(get("content")).to_s end |
#files ⇒ Object
persisted files for this post
31 32 33 34 |
# File 'lib/comment.rb', line 31 def files cached = FileAttachment.list_cache files = cached.select{|f|f.post_id == id} end |
#permalink(mobile = false) ⇒ Object
permalink to this comment
9 10 11 12 13 14 15 |
# File 'lib/comment.rb', line 9 def permalink(mobile=false) if mobile "http://#{Flareshow::Service.server.host}/#{Flareshow::Service.server.domain}/shareflow/mobile/post/#{reply_to}" else "http://#{Flareshow::Service.server.host}/#{Flareshow::Service.server.domain}/shareflow/p/#{reply_to}?comment_id#{id}" end end |
#post ⇒ Object
get the post for this comment
18 19 20 21 |
# File 'lib/comment.rb', line 18 def post post = Post.get_from_cache(reply_to) post || Post.first(:id => reply_to) end |