lib/ar_fixtures.rb
# Generates a basic fixture file in test/fixtures that lists the table's field names.
#
# You can use it as a starting point for your own fixtures.
#
#  record_1:
#    name:
#    rating:
#  record_2:
#    name:
#    rating:
#
# TODO Automatically add :id field if there is one.
Generates a basic fixture file in test/fixtures that lists the table's field names.
You can use it as a starting point for your own fixtures.




Generates a basic fixture file in test / fixtures that lists the table ' s field names . You can use it as a starting point for your own fixtures .
def to_skeleton
      record = {
        "record_1" => self.new.attributes,
        "record_2" => self.new.attributes
      }
      write_file(File.expand_path("test/fixtures/#{table_name}.yml", RAILS_ROOT),
      record.to_yaml)
    end
def to_skeleton record = { "record_1" => self . new . attributes , "record_2" => self . new . attributes } write_file ( File . expand_path ( "test/fixtures/#{table_name}.yml" , RAILS_ROOT ) , record . to_yaml ) end
Generates a basic fixture file in test/fixtures that lists the table's field names.
Generates a basic fixture file in test / fixtures that lists the table ' s field names .