app/controllers/application_controller.rb
def slug
Apartment::Database.current
end
def crowdslug
@_crowdshop.slug
end
helper_method :crowdslug
def slugged?
slug != "public"
end
def find_company
@_company = Company.where(slug: slug).first
end
Apartment::Database.current
end
def crowdslug
@_crowdshop.slug
end
helper_method :crowdslug
def slugged?
slug != "public"
end
def find_company
@_company = Company.where(slug: slug).first
end
db/schema.rb line: 115
create_table "companies", force: true do |t|
t.string "slug"
t.string "name"
t.integer "account_id"
t.datetime "created_at"
t.datetime "updated_at"
t.boolean "enabled", default: false
t.string "password", default: "", null: false
end
add_index "companies", ["account_id"], name: "index_companies_on_account_id", using: :btree
add_index "companies", ["name"], name: "index_companies_on_name", using: :btree
add_index "companies", ["slug"], name: "index_companies_on_slug", unique: true, using: :btree
t.string "slug"
t.string "name"
t.integer "account_id"
t.datetime "created_at"
t.datetime "updated_at"
t.boolean "enabled", default: false
t.string "password", default: "", null: false
end
add_index "companies", ["account_id"], name: "index_companies_on_account_id", using: :btree
add_index "companies", ["name"], name: "index_companies_on_name", using: :btree
add_index "companies", ["slug"], name: "index_companies_on_slug", unique: true, using: :btree
config/initializers/apartment.rb
Apartment.configure do |config|
config.excluded_models = [
"Company",
"Account",
"Product",
"Variation",
"Tax",
"CrowdshopsProduct",
"PaperTrail::Version"
]
config.use_schemas = true
# config.default_schema = "excluded"
# configure persistent schemas (E.g. hstore )
# config.persistent_schemas = [ "public" ]
# supply list of database names for migrations to run on
config.tenant_names = -> { Company.pluck(:slug) }
end
config.excluded_models = [
"Company",
"Account",
"Product",
"Variation",
"Tax",
"CrowdshopsProduct",
"PaperTrail::Version"
]
config.use_schemas = true
# config.default_schema = "excluded"
# configure persistent schemas (E.g. hstore )
# config.persistent_schemas = [ "public" ]
# supply list of database names for migrations to run on
config.tenant_names = -> { Company.pluck(:slug) }
end
No comments:
Post a Comment