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 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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to