Questions tagged [apartment-gem]

Database multi-tenancy for Rack (and Rails) applications

Apartment provides tools to help you deal with multiple tenants in your Rails application. It helps you to have certain data sequestered based on account or company, but still allow some data to exist in a common tenant.

Resources:

176 questions
0
votes
0 answers

How to create has_many relationship from apartment public schema to

My model setup class User < AR has_many :books ... end class Book < AR belongs_to :user ... end Books are in separate apartments and users are in the public schema. I would like to add a shared model called assignment (to assign a book…
sakurashinken
  • 3,940
  • 8
  • 34
  • 67
0
votes
5 answers

Using www at 2nd level subdomain ignores the 1st level subdomain in apartment

I have subdomains like: lks.harabiz.com & lkm.harabiz.com, each with its own database tables. When somebody tries the URL: www.lkm.harabiz.com, the database tables being used are different from lkm's, and those database tables actually belong to…
Arslan Ali
  • 17,418
  • 8
  • 58
  • 76
0
votes
1 answer

Once added, Chrome now always prepends www with the domain name

I'm using Apartment gem, with Rails 5.0.0.1. The URL that I'm trying to access is: lkm.harabiz.com, and accidentally, I attached www with it, and it became: www.lkm.harabiz.com, and now I can't access lkm.harabiz.com. Each time I try to access:…
Arslan Ali
  • 17,418
  • 8
  • 58
  • 76
0
votes
1 answer

Rails Apartment gem error generate model

I'm building a multi-tenant application using Apartment gem. But when i am scaffolding or generating any model i am getting the below error : rails g model Car…
0
votes
2 answers

Apartment gem giving unexpected error when generating model on Rails 5.1.0

I am new to rails platform. I'm building a multi-tenant application using Apartment gem. I'm following https://medium.com/@balogic/using-apartment-gem-to-implement-multitenant-concept-in-rails-b86f7d9e37c5 this guide to learn how to use this gem.…
0
votes
0 answers

Getting rails error No route matches [GET] "/users/sign_in"

I am trying to set up a multi tenancy app and i am having this issue here and i can not figure out what is going on. i keep getting this error. here is my routes.rb what am I missing here. class SubdomainPresent def self.matches?(request) …
0
votes
2 answers

No route matches [GET] "/accounts.json"

I am attempting to provide a user with the ability to create a subdomain. When clicking Create Account, the system redirects from "accounts/new" to "accounts" and no subdomain is getting populated. routes.rb class SubdomainPresent def…
nomad
  • 45
  • 9
0
votes
1 answer

Adding Static Subdomain outside of Apartment tenant rails 4

I'm having issues trying to add a static subdomain while also running apartment gem.. Essentially I want to do something like: constraints subdomain: 'docs' do get 'some/page' end however when I place this code in my routes file and attempt to…
Shawn Wilson
  • 1,311
  • 14
  • 40
0
votes
1 answer

Not sure how to approach using a Plan Validator on User to check if the Plan is at max allowable users Rails 4 Devise Invitable

Im building out a multi-tenant app in Rails 4 using the Apartment Gem, this is a subscription based application and limits the number of users by the plan type. I have the following validation in my Plan Model (I'll paste the whole thing here), but…
0
votes
2 answers

Rails 4 Heroku Multi-tenancy app redirecting to heroku homepage

Ok so im really lost and not even too sure what to post here for information. I am Brand new to multi tenancy, i have followed a tutorial on using the apartment gem. Everything is working perfectly on lvh.me:3000, however when I push the app to…
0
votes
0 answers

Rails multi tenant app

I'm creating a multi tenant app that something like project management software. In my structure, there is a User table that excluded from multi tenant. User comes my sign-up page, fills the subdomain field called Company then I create a schema for…
utkuDAT
  • 334
  • 1
  • 3
  • 16
0
votes
1 answer

using pg_search with apartment gem

I'm trying to use the pg_search gem in combination with a multi tenancy application enabled by the apartment gem. Apartment seperates my data with a schema per tenant. Searching withing each tenant works well with the pg_search default settings, but…
wiiiim
  • 63
  • 6
0
votes
1 answer

Create constraints in rails migrations

I have a migration that create a named constraint execute(%Q{ ALTER TABLE dreamflore_clients ADD CONSTRAINT unique_clients UNIQUE( client, no_adresse ); }) But in schema.rb, rails turn this part into an index add_index "dreamflore_clients",…
m4tm4t
  • 2,361
  • 1
  • 21
  • 37
0
votes
1 answer

Building a multi-location app in rails

I am trying to build a multi-location app from a client. I have tried dabbling with Apartment and other types of multitenancy but didn't receive a proper result. The app should have domains for each location as follows: e.g. example.com/newyork,…
af_dig
  • 1
  • 1
0
votes
1 answer

Request.host in initializer Rails 4

I am using the Apartment gem for a multi-tenant app and I'm using the "host_hash elevator" to switch the tenant based on the subdomain and host of the request. This is done with the below code (from their documentation):…
Steve Q
  • 395
  • 5
  • 28
1 2 3
11
12