Module: EacRailsUtils::Models::TablelessAssociations::OverrideMethods

Extended by:
ActiveSupport::Concern
Included in:
EacRailsUtils::Models::TablelessAssociations
Defined in:
lib/eac_rails_utils/models/tableless_associations/override_methods.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#association(name) ⇒ Object

use by association accessor



90
91
92
93
94
95
96
97
98
99
# File 'lib/eac_rails_utils/models/tableless_associations/override_methods.rb', line 90

def association(name) # :nodoc:
  association = association_instance_get(name)

  if association.nil?
    association = association_by_reflection(name)
    association_instance_set(name, association)
  end

  association
end

#deprecated_associations_api_guard(association, method_name) ⇒ Object



104
105
106
107
108
# File 'lib/eac_rails_utils/models/tableless_associations/override_methods.rb', line 104

def deprecated_associations_api_guard(association, method_name)
  ActiveRecord::Associations::Deprecation.guard(association.reflection) do
    "the method #{method_name} was invoked"
  end
end

#new_record?Boolean

dummy

Returns:

  • (Boolean)


121
122
123
# File 'lib/eac_rails_utils/models/tableless_associations/override_methods.rb', line 121

def new_record?
  false
end

#read_attribute(name) ⇒ Object Also known as: _read_attribute



115
116
117
# File 'lib/eac_rails_utils/models/tableless_associations/override_methods.rb', line 115

def read_attribute(name)
  send(name)
end

#report_deprecated_association(reflection, context:) ⇒ Object



110
111
112
# File 'lib/eac_rails_utils/models/tableless_associations/override_methods.rb', line 110

def report_deprecated_association(reflection, context:)
  ActiveRecord::Associations::Deprecation.report(reflection, context: context)
end

#strict_loading?Boolean

dummy

Returns:

  • (Boolean)


126
127
128
# File 'lib/eac_rails_utils/models/tableless_associations/override_methods.rb', line 126

def strict_loading?
  false
end

#strict_loading_modeObject

dummy



136
137
138
# File 'lib/eac_rails_utils/models/tableless_associations/override_methods.rb', line 136

def strict_loading_mode
  :all
end

#strict_loading_n_plus_one_only?Boolean

dummy

Returns:

  • (Boolean)


131
132
133
# File 'lib/eac_rails_utils/models/tableless_associations/override_methods.rb', line 131

def strict_loading_n_plus_one_only?
  false
end