Class: ActiveRecord::Associations::Association

Inherits:
Object
  • Object
show all
Defined in:
lib/activerecord-multi-tenant/model_extensions.rb

Overview

skips statement caching for classes that is Multi-tenant or has a multi-tenant relation

Instance Method Summary collapse

Instance Method Details

#skip_statement_cache?(*scope) ⇒ Boolean

Returns:

  • (Boolean)


194
195
196
197
198
199
200
201
202
203
# File 'lib/activerecord-multi-tenant/model_extensions.rb', line 194

def skip_statement_cache?(*scope)
  return true if klass.respond_to?(:scoped_by_tenant?) && klass.scoped_by_tenant?

  if reflection.through_reflection
    through_klass = reflection.through_reflection.klass
    return true if through_klass.respond_to?(:scoped_by_tenant?) && through_klass.scoped_by_tenant?
  end

  skip_statement_cache_orig(*scope)
end

#skip_statement_cache_origObject



192
# File 'lib/activerecord-multi-tenant/model_extensions.rb', line 192

alias skip_statement_cache_orig skip_statement_cache?