All threads / Integrating Mailboxer with Apartment

Ask A Question

Notifications

You’re not receiving notifications from this thread.

Integrating Mailboxer with Apartment

Satchit Shenoy asked in General

Hi,

I'm trying to integrate mailboxer with apartment, and am having an issue with migrating the tables. I want the mailing service to be universally applied to the app, but apartment migrates the tables for each schema. This creates multiple mailboxes for each subdomain, which is not the desired effect. There are no models to exclude with mailboxer. Is there a workaround?

Thanks,

Satchit

Oh this is an interesting one. I believe you'll have those tables in all the tenant schemas because of the way the gem works, but you'll be able to exclude the Mailboxer models so that they operate outside of the tenants like you would do with your User model for example.

Check out this section and see if that helps. I believe you'll want the migrations to run as they have already, then just add all the Mailboxer models to this config. https://github.com/influitive/apartment#excluding-models

Tried that.. Sadly, didn't work. Got an unrecognized constant error. Is there any way that I could run migrations for public domain only when it comes to mailboxer?

Hey Chris... Alright, this did work, using the scope operator - Mailbox::Conversation, etc..Thanks for pushing me to prod further :)

Join the discussion

Want to stay up-to-date with Ruby on Rails?

Join 37,344+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    logo Created with Sketch.

    Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

    © 2020 GoRails, LLC. All rights reserved.