Skip to content
Browse files

Generated fixtures use the actual primary key instead of id. Closes #…

…4343.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7899 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent ae8179f commit 2e2ce1f6c99e3423e817003927997f28ba20365b @jeremy jeremy committed Oct 15, 2007
View
2 railties/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Generated fixtures use the actual primary key instead of id. #4343 [Frederick Ros, Tarmo Tänav]
+
* Extend the console +helper+ method to allow you to include custom helpers. e.g:
>> helper :posts
>> helper.some_method_from_posts_helper(Post.find(1))
View
4 railties/lib/rails_generator/generators/components/model/templates/fixtures.yml
@@ -1,13 +1,13 @@
# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
one:
- id: 1
+ <%= class_name.constantize.primary_key %>: 1
<% for attribute in attributes -%>
<%= attribute.name %>: <%= attribute.default %>
<% end -%>
created_at: <%= Time.now.to_s(:db) %>
updated_at: <%= Time.now.to_s(:db) %>
two:
- id: 2
+ <%= class_name.constantize.primary_key %>: 2
<% for attribute in attributes -%>
<%= attribute.name %>: <%= attribute.default %>
<% end -%>

0 comments on commit 2e2ce1f

Please sign in to comment.
Something went wrong with that request. Please try again.