Amie Fudge

Joined

2,220 Experience
14 Lessons Completed
1 Question Solved

Activity

Posted in How do I migrate apartment gem to Heroku correctly?

I've implemented the apartment gem and am able to run it in my local environment. However, when I deployed to Heroku, the site won't load and I get this error in the logs Apartment::TenantNotFound (One of the following schema(s) is invalid: "immense-atoll-80386" "public"):

Has anyone run into this before? Any ideas on what I am missing

Posted in How do I return a scope that I think includes a select?

Oh that's great to hear, Clint - happy it was a help :)

would a convention for booleans like this work
Booleans for pending behaviour:
noun followed by past_tense_verb: admin_requested, account_requested, terms_requested, etc.

Booleans for current state:
present_tense_verb followed by noun: is_admin, has_account, accepted_terms, etc.,

In the past we have added a naming convention for tables and columns in our data dictionary. If you don't have documentation that is that formal, I would just add a page on a wiki or confluence

Posted in How do I return a scope that I think includes a select?

I just tried to do the same with my Users and Roles

In my Role model I defined a class method call available

def self.available
@users = User.all
Role.where.not(id: @users.pluck(:role_id).uniq)
end

In my form for the dropdown I use this

<%= f.collection_select :role_id, Role.available, :id, :name, {class: 'form-control bootstrap-select', required: :required} %>

I think you could adjust the code above to work with your orgchart / positions

Posted in Global User for Multi-Tenancy with Local Tenant Users

I'm watching the rails tutorial on the apartment gem and am curious how to manage my Users, which I've already created through Devise and implemented User Roles.

Essentially, I want one Super User to have access to all tenants (that would be me). One Tenant User who logs in globally and gets switched to his/her tenant (this person would be my customer) and then all other Users to be within the Tenant subdomain. (i.e. staff and customers of the Tenant Owner). I want the Tenant Owner to manage their own users within their subdomain but not have access to any other users.

Do I have to create another User class? Devise is not my friend and I'd hate to muck around with that any more than I have to. Creating a parent without Devise would be the ideal way for me to go but I still want the Devise authenticaton that I've already implemented on the User class. Asking too much?