intercom-rails
intercom-rails copied to clipboard
Around filter - bug?
Version info
- intercom-rails version: 0.3.2
- Rails version: 4.0.13
Expected behavior
current_user.current_company need to be set any value with a around_filter method, because a multi tenant scope.
Actual behavior
current_user.current_company is a company object with "visitor" value
Steps to reproduce
- Create a follow method in application controller
around_action :scope_current_user
def scope_current_user
current_user.current_company = Company.find_by_scope current_user, session
yield
ensure
current_user.current_company = Company.new name: 'visitor'
end
How to work around
skip_after_filter :intercom_rails_auto_include
around_action :scope_current_user
after_filter :intercom_rails_auto_include