intercom-rails icon indicating copy to clipboard operation
intercom-rails copied to clipboard

Around filter - bug?

Open fabiosammy opened this issue 9 years ago • 0 comments

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

  1. 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

fabiosammy avatar Jul 31 '16 16:07 fabiosammy