Situation: I want to validate some user permissions immediately before saving a document, so the obvious solution I came up with was to make a DocumentObserver and modify the before_save method to do the check. However, the problem with doing this is that models can't easily (and shouldn't) access current_user, which would be necessary to perform the check. I understand it is possible to hack around this by using Thread, but I'd rather follow standard practices if possible. Is there a way to make this happen or a better way to achieve the same result? The observer just seems like such an intuitive and simple solution, it'd be a shame not to use it.
Considerations: My problem is similar to this one, but I was hoping to get a more concrete answer or suggestion. For reference, here is the current_user workaround
Revision: Further complication - the controller is in a third party gem that I cannot modify, meaning I can't simply pass in the current_user to the model. this complication may force me to patch over some of the third party's methods or something, unless there's some other clever way to get this to work...