Displaying 2 results from an estimated 2 matches for "transform_comment".
2006 May 31
0
acts_as_blog
...form_post
self.post = Post.convert_to_html(self.raw_post, ''textile'')
end
====================================================================
#Here is an example of the comments model.
class Comment < ActiveRecord::Base
acts_as_blog
belongs_to :post
before_save :transform_comment
## validation checks
validates_presence_of :name, :raw_comment
## we filter out all html tags except those created by the markup
def transform_comment
self.comment =
Comment.convert_to_html(self.raw_comment,''textile'',[:filter_html])
end
===========================...
2006 Feb 28
0
help with sanitizing html (comments in blog)
...t blogs so I''m not sure if this is adequate or not for
comments. What do you think? I would love to hear if this is safe,
unsafe, or just plain bad form. Also, I don''t think that RedCloth is
creating line breaks. Please, all suggestions are welcome and
appreciated!
def transform_comment
self.comment = self.comment.to_s.gsub(/&/, "&").gsub(/\"/,
""").gsub(/>/, ">").gsub(/</, "<")
self.comment = RedCloth.new(self.comment,[:filter_html]).to_html
end
Charlie Bowman
--
Posted via http://...