Flowdock
method

source_reflection_name

Importance_0
v4.1.8 - Show latest stable - 0 notes - Class: ActiveRecord::Reflection::ThroughReflection
source_reflection_name() public

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File activerecord/lib/active_record/reflection.rb, line 655
      def source_reflection_name # :nodoc:
        return @source_reflection_name.to_sym if @source_reflection_name

        names = [name.to_s.singularize, name].collect { |n| n.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 :sourcedirective on your declaration like:  class #{active_record.name} < ActiveRecord::Base    #{macro} :#{name}, #{example_options}  end
        end

        @source_reflection_name = names.first
      end
Register or log in to add new notes.