method
collection_reader_method
collection_reader_method(reflection, association_proxy_class)
private
Hide source
# File activerecord/lib/active_record/associations.rb, line 950 def collection_reader_method(reflection, association_proxy_class) define_method(reflection.name) do |*params| force_reload = params.first unless params.empty? association = instance_variable_get("@#{reflection.name}") unless association.respond_to?(:loaded?) association = association_proxy_class.new(self, reflection) instance_variable_set("@#{reflection.name}", association) end association.reload if force_reload association end end