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:
-
How can I check here if saving process has been initialized by
specified, logged in user (admin)? -
What is the best way to abstract these operations to use them easily
on multiple models?