Skip to content

Commit

Permalink
I have updated the documentation according to ticket rails#4263 about…
Browse files Browse the repository at this point in the history
… fixtures and set_fixture_class

Signed-off-by: José Valim <jose.valim@gmail.com>
  • Loading branch information
franckverrot authored and josevalim committed May 16, 2010
1 parent d61dbce commit 621ee37
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion railties/guides/source/active_record_basics.textile
Expand Up @@ -104,6 +104,14 @@ class Product < ActiveRecord::Base
set_table_name "PRODUCT"
end
</ruby>
If you do so, you will have to define manually the class name that is hosting the fixtures (class_name.yml) using the +set_fixture_class+ method in your test definition:
<ruby>
class FunnyJoke < ActiveSupport::TestCase
set_fixture_class :funny_jokes => 'Joke'
fixtures :funny_jokes
...
end
</ruby>

It's also possible to override the column that should be used as the table's primary key. Use the +ActiveRecord::Base.set_primary_key+ method for that:
<ruby>
Expand Down Expand Up @@ -201,4 +209,4 @@ Active Record callbacks allow you to attach code to certain events in the life-c

h3. Migrations

Rails provides a domain-specific language for managing a database schema called migrations. Migrations are stored in files which are executed against any database that Active Record support using rake. Rails keeps track of which files have been committed to the database and provides rollback features. You can learn more about migrations in the "Active Record Migrations guide":migrations.html
Rails provides a domain-specific language for managing a database schema called migrations. Migrations are stored in files which are executed against any database that Active Record support using rake. Rails keeps track of which files have been committed to the database and provides rollback features. You can learn more about migrations in the "Active Record Migrations guide":migrations.html

0 comments on commit 621ee37

Please sign in to comment.