Class ActiveRecord::Base
In: lib/ar_fixtures.rb
Parent: Object

Extension to make it easy to read and write data to a file.

Methods

Public Class methods

Writes content of this table to db/table_name.yml, or the specified file.

Writes all content by default, but can be limited.

Write the habtm association table

Delete existing data in database and load fresh from file in db/table_name.yml

Write a file that can be loaded with +fixture :some_table+ in tests. Uses existing data in the database.

Will be written to +test/fixtures/table_name.yml+. Can be restricted to some number of rows.

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.

[Validate]