Account#slug uses the virtual "tenant" attribute
This commit is contained in:
@@ -4,7 +4,7 @@ class Account < ApplicationRecord
|
||||
has_many_attached :uploads
|
||||
|
||||
def slug
|
||||
"/#{tenant_id}"
|
||||
"/#{tenant}"
|
||||
end
|
||||
|
||||
def setup_basic_template
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
echo "Login with david@37signals.com / secret123456 to:"
|
||||
bin/rails runner - <<EOF
|
||||
puts "Login with david@37signals.com / secret123456 to:"
|
||||
ApplicationRecord.with_each_tenant do |tenant|
|
||||
next unless tenant =~ /\A\d+\z/
|
||||
if Account.sole.tenant_id
|
||||
puts " - #{Account.sole.name}: http://fizzy.localhost:3006/#{Account.sole.tenant_id}"
|
||||
end
|
||||
puts " - #{Account.sole.name}: http://fizzy.localhost:3006#{Account.sole.slug}"
|
||||
end
|
||||
EOF
|
||||
|
||||
|
||||
@@ -3,6 +3,6 @@ require "test_helper"
|
||||
class AccountTest < ActiveSupport::TestCase
|
||||
test "slug" do
|
||||
account = Account.sole
|
||||
assert_equal "/#{account.tenant_id}", account.slug
|
||||
assert_equal "/#{ApplicationRecord.current_tenant}", account.slug
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user