module ActiveRecord::Core::ClassMethods
Public Instance Methods
Source
# File lib/active_record/core.rb, line 338 def filter_attributes if @filter_attributes.nil? superclass.filter_attributes else @filter_attributes end end
Returns columns which shouldn’t be exposed while calling inspect.
Source
# File lib/active_record/core.rb, line 347 def filter_attributes=(filter_attributes) @inspection_filter = nil @filter_attributes = filter_attributes end
Specifies columns which shouldn’t be exposed while calling inspect.
Private Instance Methods
Source
# File lib/active_record/core.rb, line 430 def cached_find_by(keys, values) with_connection do |connection| statement = cached_find_by_statement(connection, keys) { |params| wheres = keys.index_with do |key| if key.is_a?(Array) [key.map { params.bind }] else params.bind end end where(wheres).limit(1) } statement.execute(values.flatten, connection, allow_retry: true).then do |r| r.first rescue TypeError raise ActiveRecord::StatementInvalid end end end
Source
# File lib/active_record/core.rb, line 398 def inherited(subclass) super # initialize cache at class definition for thread safety subclass.initialize_find_by_cache unless subclass.base_class? klass = self until klass.base_class? klass.initialize_find_by_cache klass = klass.superclass end end subclass.class_eval do @arel_table = nil @predicate_builder = nil @inspection_filter = nil @filter_attributes ||= nil @generated_association_methods ||= nil end end
Calls superclass method
Source
# File lib/active_record/core.rb, line 420 def relation relation = Relation.create(self) if finder_needs_type_condition? && !ignore_default_scope? relation.where!(type_condition) else relation end end