Skip to content

Does intercom-rails support for rails engine? #280

Open
@dieuyunchang

Description

@dieuyunchang

Hi guys, thank you for building the great app. I got the problem with intercom when I am using engine app.

Version info

  • intercom-rails version: 0.3.5
  • Rails version: 5.1.4

Expected behavior

  • Intercom should load the correct user inside engine app and root app.

Actual behavior

  • Intercom got the latest user signed in on 2 apps. ( 2 sessions (one for root app, one for engine app) are in the same browser).

Steps to reproduce

  1. Root app is using Intercom ( added config intercom.rb file)
config.user.custom_data = {
    :company_admin => Proc.new { |user| user.company_admin? },
}
  1. Add new engine app inside named "ABC"
  2. I create new config file intercom.rb in root_app/engines/config/initializers/intercom.rb and update
config.user.current = Proc.new { current_abc_user } #current_abc_user model class is ABC::User
config.user.custom_data = {
    :admin => Proc.new { |user| user.admin? },
}
  1. The engine app raise error with user.company_admin? (because that user object model hasn't defined the method company_admin?)

Thank you. 🙇

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions