as_user lets you run a block as another user
Parameters:
39 40 41 42 43 44 45 46
# File 'lib/volt/volt/users.rb', line 39 def as_user(user_id) previous_id = Thread.current['with_user_id'] Thread.current['with_user_id'] = user_id yield Thread.current['with_user_id'] = previous_id end