Parent

Included Modules

Class/Module Index [+]

Quicksearch

Comment

Constants

NUM

Public Class Methods

build_for(set_commentable, user, text,attr={}) click to toggle source
# File app/models/comment.rb, line 20
def self.build_for(set_commentable, user, text,attr={})
  c = new
  raise "Tried to build comment for non commentable" unless set_commentable.try(:is_commentable?)
    c.user=user
    c.text=text
    c.assign_attributes(attr)
  
  unless set_commentable.class.to_s == "Comment"
    c.commentable=set_commentable
    c.save    
  else
    
    c.commentable=set_commentable.commentable
    c.save
    c.move_to_child_of(set_commentable)
  end
  c
end
formid_for(c) click to toggle source
# File app/models/comment.rb, line 53
def self.formid_for(c)
  "comment_form_" + c.class.to_s.gsub(":","_") + "_" + c.id.to_s 
end
switchshowid_for(c) click to toggle source
# File app/models/comment.rb, line 46
def self.switchshowid_for(c)
  "show_comments_" + c.class.to_s.gsub(":","_") + "_" + c.id.to_s
end
wrapid_for(c) click to toggle source
# File app/models/comment.rb, line 42
def self.wrapid_for(c)
  "comments_" + c.class.to_s.gsub(":","_") + "_" + c.id.to_s
end

Public Instance Methods

formid() click to toggle source
# File app/models/comment.rb, line 50
def formid
  "comment_form_" + commentable_type.gsub(":","_") + "_" + commentable_id.to_s 
end
parent_object() click to toggle source
# File app/models/comment.rb, line 13
def parent_object
  if self.root?
    self.commentable
  else
    self.parent
  end
end
thumb_url() click to toggle source
# File app/models/comment.rb, line 38
def thumb_url
  t_url= user.fetprofile.picture.thumb.url unless user.nil? or user.fetprofile.nil?
  t_url
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.