ActiveRecord::Base
# 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
# File app/models/comment.rb, line 53 def self.formid_for(c) "comment_form_" + c.class.to_s.gsub(":","_") + "_" + c.id.to_s end
# File app/models/comment.rb, line 50 def formid "comment_form_" + commentable_type.gsub(":","_") + "_" + commentable_id.to_s end
Generated with the Darkfish Rdoc Generator 2.