Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Rails Pacific - Multitenancy with Rails

Ryan Bigg
October 25, 2014

Rails Pacific - Multitenancy with Rails

Covers the lessons learned about Multitenancy with Rails in the process of writing my book.

Ryan Bigg

October 25, 2014
Tweet

More Decks by Ryan Bigg

Other Decks in Programming

Transcript

  1. “If you are using PostgreSQL, Apartment by default will set

    up a new schema and migrate into there.”
  2. “If you are using PostgreSQL, Apartment by default will set

    up a new schema and migrate into there.”
  3. “A database contains one or more named schemas, which in

    turn contain tables.” “There are several reasons why one might want to use schemas: * To allow many users to use one database without interfering with each other.”
  4. A guest on Account A’s subdomain should only see Account

    A’s posts Expected to not see “<Account B’s post>” Feature #1: Viewing Posts
  5. A guest on Account A’s subdomain should only see Account

    A’s posts Feature #1: Viewing Posts
  6. fluffy.doglife.com Fluffy’s Albums current_account = Fluffy @albums = current_account.albums fluffy.doglife.com/albums

    Fluffy’s First Birthday Pictures @pictures = @album.pictures fluffy.doglife.com/albums/1/pictures Feature #2: Viewing Pictures
  7. A guest on Account A’s subdomain should only see Account

    A’s albums Expected to not see “<Account B’s album>” Feature #2: Viewing Pictures
  8. A guest on Account A’s subdomain should only see Account

    A’s albums Feature #2: Viewing Pictures
  9. A guest on Account A’s subdomain viewing an album shows

    pictures from that album Expected to not see “<Account B’s picture>” Feature #2: Viewing Pictures
  10. A guest on Account A’s subdomain viewing an album shows

    pictures from that album Feature #2: Viewing Pictures
  11. fluffy.doglife.com Fluffy’s Albums current_account = Fluffy @albums = current_account.albums fluffy.doglife.com/albums

    Fluffy’s First Birthday Pictures @pictures = @album.pictures fluffy.doglife.com/albums/1/pictures Feature #2: Viewing Pictures