IdentityCache with Apartment Excluded Models
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Broken Example | |
class Company < ActiveRecord::Base | |
include IdentityCache | |
cache_index :subdomain | |
end | |
Company.table_name = 'public.companies' | |
Company.fetch_by_subdomain('app') | |
# => SELECT id FROM companies WHERE subdomain = 'app' LIMIT 1 | |
# Fix for Broken Example | |
class Company < ActiveRecord::Base | |
self.table_name = 'public.companies' | |
include IdentityCache | |
cache_index :subdomain | |
end | |
Company.fetch_by_subdomain('app') | |
# => SELECT id FROM public.companies WHERE subdomain = 'app' LIMIT 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment