 module ActiveRecor8b7c:f320:99b9:690f:4595:cd17:293a:c069TestFixtures8b7c:f320:99b9:690f:4595:cd17:293a:c069lassMethods     Public Instance Methods    fixtures(*fixture_set_names) Show source    # File activerecord/lib/active_record/fixtures.rb, line 850
def fixtures(*fixture_set_names)
  if fixture_set_names.first == :all
    fixture_set_names = Dir["#{fixture_path}/{**,*}/*.{yml}"]
    fixture_set_names.map! { |f| f[(fixture_path.to_s.size + 1)..-5] }
  else
    fixture_set_names = fixture_set_names.flatten.map { |n| n.to_s }
  end

  self.fixture_table_names |= fixture_set_names
  require_fixture_classes(fixture_set_names, self.config)
  setup_fixture_accessors(fixture_set_names)
end      require_fixture_classes(fixture_set_names = nil, config = ActiveRecor8b7c:f320:99b9:690f:4595:cd17:293a:c069Base) Show source    # File activerecord/lib/active_record/fixtures.rb, line 874
def require_fixture_classes(fixture_set_names = nil, config = ActiveRecor8b7c:f320:99b9:690f:4595:cd17:293a:c069Base)
  if fixture_set_names
    fixture_set_names = fixture_set_names.map { |n| n.to_s }
  else
    fixture_set_names = fixture_table_names
  end

  fixture_set_names.each do |file_name|
    file_name = file_name.singularize if config.pluralize_table_names
    try_to_load_dependency(file_name)
  end
end      set_fixture_class(class_names = {}) Show source   Sets the model class for a fixture when the class name cannot be inferred from the fixture name. Examples: set_fixture_class some_fixture:        SomeModel,
                  'namespaced/fixture' => Another8b7c:f320:99b9:690f:4595:cd17:293a:c069Model
 The keys must be the fixture names, that coincide with the short paths to the fixture files.  # File activerecord/lib/active_record/fixtures.rb, line 846
def set_fixture_class(class_names = {})
  self.fixture_class_names = self.fixture_class_names.merge(class_names.stringify_keys)
end      setup_fixture_accessors(fixture_set_names = nil) Show source    # File activerecord/lib/active_record/fixtures.rb, line 887
def setup_fixture_accessors(fixture_set_names = nil)
  fixture_set_names = Array(fixture_set_names || fixture_table_names)
  methods = Module.new do
    fixture_set_names.each do |fs_name|
      fs_name = fs_name.to_s
      accessor_name = fs_name.tr('/', '_').to_sym

      define_method(accessor_name) do |*fixture_names|
        force_reload = fixture_names.pop if fixture_names.last == true || fixture_names.last == :reload

        @fixture_cache[fs_name] ||= {}

        instances = fixture_names.map do |f_name|
          f_name = f_name.to_s
          @fixture_cache[fs_name].delete(f_name) if force_reload

          if @loaded_fixtures[fs_name][f_name]
            @fixture_cache[fs_name][f_name] ||= @loaded_fixtures[fs_name][f_name].find
          else
            raise StandardError, "No fixture named '#{f_name}' found for fixture set '#{fs_name}'"
          end
        end

        instances.size == 1 ? instances.first : instances
      end
      private accessor_name
    end
  end
  include methods
end      try_to_load_dependency(file_name) Show source    # File activerecord/lib/active_record/fixtures.rb, line 863
def try_to_load_dependency(file_name)
  require_dependency file_name
rescue LoadError => e
  unless fixture_class_names.key?(file_name.pluralize)
    if ActiveRecor8b7c:f320:99b9:690f:4595:cd17:293a:c069Base.logger
      ActiveRecor8b7c:f320:99b9:690f:4595:cd17:293a:c069Base.logger.warn("Unable to load #{file_name}, make sure you added it to ActiveSupport8b7c:f320:99b9:690f:4595:cd17:293a:c069TestCase.set_fixture_class")
      ActiveRecor8b7c:f320:99b9:690f:4595:cd17:293a:c069Base.logger.warn("underlying cause #{e.message} \n\n #{e.backtrace.join("\n")}")
    end
  end
end      uses_transaction(*methods) Show source    # File activerecord/lib/active_record/fixtures.rb, line 918
def uses_transaction(*methods)
  @uses_transaction = [] unless defined?(@uses_transaction)
  @uses_transaction.concat methods.map { |m| m.to_s }
end      uses_transaction?(method) Show source    # File activerecord/lib/active_record/fixtures.rb, line 923
def uses_transaction?(method)
  @uses_transaction = [] unless defined?(@uses_transaction)
  @uses_transaction.include?(method.to_s)
end     

    
{'path': 'public/docs/rails~4.1/activerecord/testfixtures/classmethods.html', 'source': 'DevDocs.IO'}