Class: ActiveRecord::Base

Inherits:
Object
  • Object
show all
Extended by:
ClassMethods
Includes:
InstanceMethods
Defined in:
lib/reactive_record/active_record/base.rb,
lib/reactive_record/active_record/aggregations.rb,
lib/reactive_record/active_record/associations.rb

Class Method Summary collapse

Methods included from ClassMethods

_react_param_conversion, abstract_class=, abstract_class?, all, base_class, composed_of, find, find_by, inheritance_column, inheritance_column=, method_missing, model_name, primary_key, primary_key=, scope

Methods included from InstanceMethods

#==, #attributes, #changed?, #destroy, #id, #id=, #initialize, #method_missing, #model_name, #primary_key, #revert, #save, #saving?

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class ActiveRecord::InstanceMethods

Class Method Details

.reflect_on_aggregation(attribute) ⇒ Object



9
10
11
# File 'lib/reactive_record/active_record/aggregations.rb', line 9

def self.reflect_on_aggregation(attribute)
  reflect_on_all_aggregations.detect { |aggregation| aggregation.attribute == attribute }
end

.reflect_on_all_aggregationsObject



5
6
7
# File 'lib/reactive_record/active_record/aggregations.rb', line 5

def self.reflect_on_all_aggregations
  base_class.instance_eval { @aggregations ||= [] }
end

.reflect_on_all_associationsObject



5
6
7
# File 'lib/reactive_record/active_record/associations.rb', line 5

def self.reflect_on_all_associations
  base_class.instance_eval { @associations ||= superclass.instance_eval { (@associations && @associations.dup) || [] } }
end

.reflect_on_association(attribute) ⇒ Object



9
10
11
# File 'lib/reactive_record/active_record/associations.rb', line 9

def self.reflect_on_association(attribute)
  reflect_on_all_associations.detect { |association| association.attribute == attribute }
end