method

find_target

Importance_0
v2.3.8 - Show latest stable - 0 notes - Class: ActiveRecord::Associations::BelongsToAssociation
find_target() private

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/associations/belongs_to_association.rb, line 45
        def find_target
          find_method = if @reflection.options[:primary_key]
                          "find_by_#{@reflection.options[:primary_key]}"
                        else
                          "find"
                        end
          the_target = @reflection.klass.send(find_method,
            @owner[@reflection.primary_key_name],
            :select     => @reflection.options[:select],
            :conditions => conditions,
            :include    => @reflection.options[:include],
            :readonly   => @reflection.options[:readonly]
          ) if @owner[@reflection.primary_key_name]
          set_inverse_instance(the_target, @owner)
          the_target
        end
Register or log in to add new notes.