Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ gem "rails", github: "rails/rails"

# Drivers
gem "sqlite3", "~> 2.5"
gem "activerecord-tenanted", github: "basecamp/activerecord-tenanted"
gem "redis", ">= 4.0.1"

# Deployment
Expand Down
10 changes: 10 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
GIT
remote: https://github.com/basecamp/activerecord-tenanted.git
revision: 30a888a1c890f180f7a1a92b7743c19e344536f3
specs:
activerecord-tenanted (0.6.0)
activerecord (>= 8.1.beta)
railties (>= 8.1.beta)
zeitwerk

GIT
remote: https://github.com/basecamp/useragent.git
revision: 433ca320a42db1266c4b89df74d0abdb9a880c5e
Expand Down Expand Up @@ -375,6 +384,7 @@ PLATFORMS
x86_64-linux

DEPENDENCIES
activerecord-tenanted!
bcrypt (~> 3.1.7)
brakeman
capybara
Expand Down
1 change: 1 addition & 0 deletions app/models/application_record.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
class ApplicationRecord < ActiveRecord::Base
primary_abstract_class
tenanted
end
2 changes: 1 addition & 1 deletion bin/dev
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env sh

echo "Starting Writebook on http://localhost:3007"
echo "Starting Writebook on http://writebook.localhost:3007"

exec ./bin/rails server -p 3007
9 changes: 6 additions & 3 deletions config/database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,17 @@ default: &default
development:
primary:
<<: *default
database: storage/db/development.sqlite3
database: storage/tenants/%{tenant}/db/development.sqlite3
tenanted: true

test:
primary:
<<: *default
database: storage/db/test.sqlite3
database: storage/tenants/%{tenant}/db/test.sqlite3
tenanted: true

production:
primary:
<<: *default
database: storage/db/production.sqlite3
database: storage/tenants/%{tenant}/db/production.sqlite3
tenanted: true
3 changes: 3 additions & 0 deletions config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.

# Allow tenant subdomains in development
config.hosts << /.*\.writebook\.localhost/

# In the development environment your application's code is reloaded any time
# it changes. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
Expand Down
Loading