Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Adding apartment to our api project
  1. add apartment to gemfile
  2. run initializer to generate config/apartment.rb
  3. Create our Event model (which maps to schemas)
  4. before_validate: create self.schema that uses .parameterize.underscore from self.name on event model
  5. after_create: create new apartment tenant on the event model
  6. Set up the config to ignore a few of our models that are public
  7. hard code the config to select a single event schema, for now
  8. migrate over all the data:
scans = Scan.all
Apartment::Tenant.switch!('old-event')
scans.each{ |s| Scan.create(s.attributes) }

that was it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment