Hi, I have the following code that allows me to call before_validation :acts_as_tagless in my models. I would like to put this into aplugin so I can do somthing like acts_as_tagless :fieldName, :fieldName, :etc any suggestions on where to start? Thanks, Scot # #removes html tags def acts_as_tagless string_attributes = {} self.attributes.each do |each_name, each_attribute| if each_attribute.kind_of? String string_attributes[each_name] = strip_tags(each_attribute) end end self.attributes = string_attributes end # #strip_tags function taken from ActionView def self.strip_tags(html) if html.index("<") text = "" tokenizer = HTML::Tokenizer.new(html) while token = tokenizer.next node = HTML::Node.parse(nil, 0, 0, token, false) # result is only the content of any Text nodes text << node.to_s if node.class == HTML::Text end # strip any comments, and if they have a newline at the end (ie. line with # only a comment) strip that too text.gsub(/<!--(.*?)-->[\n]?/m, "") else html # already plain text end end -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---