search for: set_html_plain

Displaying 1 result from an estimated 1 matches for "set_html_plain".

2009 Oct 23
0
Sanitize html with :before_save depending on logged in user
I woud like to sanitize attributes (with ''sanitize" gem) but unless the model is being saved by admin. (Suppose this model doesn''t have any relationship with user model) # In model.rb: :before_save set_html_plain def set_html_plain self.body = Sanitize.clean(self.body) end Two questions: 1) How can I check here if saving process has been initialized by specified, logged in user (admin)? 2) What is the best way to abstract these operations to use them easily on multiple models? -- Posted via h...