Class: Comment

Inherits:
Flareshow::Resource show all
Extended by:
Flareshow::Searchable
Defined in:
lib/comment.rb

Instance Method Summary collapse

Methods included from Flareshow::Searchable

search

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

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

#postObject

get the post for this comment



18
19
20
# File 'lib/comment.rb', line 18

def post
  Post.first(:id => post_id)
end

#userObject

user for this post



23
24
25
26
# File 'lib/comment.rb', line 23

def user
  return User.current unless user_id
  User.first({:id => user_id})
end