method
source_reflection_name
v5.0.0.1 -
Show latest stable
-
0 notes -
Class: ActiveRecord::Reflection::ThroughReflection
- 1.0.0
- 1.1.6
- 1.2.6
- 2.0.3
- 2.1.0
- 2.2.1
- 2.3.8
- 3.0.0
- 3.0.9
- 3.1.0
- 3.2.1
- 3.2.8
- 3.2.13
- 4.0.2
- 4.1.8 (0)
- 4.2.1 (0)
- 4.2.7 (0)
- 4.2.9 (0)
- 5.0.0.1 (0)
- 5.1.7 (0)
- 5.2.3 (0)
- 6.0.0 (0)
- 6.1.3.1 (0)
- 6.1.7.7 (0)
- 7.0.0 (0)
- 7.1.3.2
- 7.1.3.4
- What's this?
source_reflection_name()
public
Hide source
# File activerecord/lib/active_record/reflection.rb, line 865 def source_reflection_name # :nodoc: return @source_reflection_name if @source_reflection_name names = [name.to_s.singularize, name].collect(&:to_sym).uniq names = names.find_all { |n| through_reflection.klass._reflect_on_association(n) } if names.length > 1 example_options = options.dup example_options[:source] = source_reflection_names.first ActiveSupport::Deprecation.warn "Ambiguous source reflection for through association. Please " "specify a :source directive on your declaration like:\n" "\n" " class #{active_record.name} < ActiveRecord::Base\n" " #{macro} :#{name}, #{example_options}\n" " end" end @source_reflection_name = names.first end