Skip to content

case sensitive comparison in lookup based on Tenant.url_identifier #2

@wkempterGit

Description

@wkempterGit

if I create a tenant.. Tenant.create(:url_identifier => "SomePlace.lvh.me", :schema_name = "SomePlace")

Then attempt to navigate via a browser to the app using http://SomePlace.lvh.me:3000/

An error is returned via Roomer...

No tenant found for 'someplace.lvh.me' url identifier

This is due to the method current_tenant defined in lib/roomer/extensions/controller.rb and case-sensitive comparisons in the postgresSQL database

def current_tenant
@current_tenant ||= Roomer.tenant_model.find_by_url_identifier(url_identifier)
end

Because postgres uses case sensitive string comparision and the url is stored in the database with mixed case while the url returned by request.host is lowercase the tenant record is not found.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions