Topic: Fixtures file overwting the data instead of adding as new record

Hi All,

I'm trying to write one small script to add the data in user table but it's overwriting over the existing records. Here I'm giving those scripts-

Create_User.rb file in Unit Folder:

require File.dirname(__FILE__) + '/../test_helper'

class OrganizationTest < Test::Unit::TestCase
 
  fixtures :users
 
  # Replace this with your real tests.
  def test_create_user
    user = users.new(:id => id+1,
                             :login => "test",
                             :salted_password => 123456789,
                             :email => "test@test.com")

User.yml file in fixtures folder:

# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html

users:
   id: id+1
   login: test
   salted_password: 123456789
   email: test@test.com

These scripts are overwriting the data over the existing records instead of add as new record. If you have any clue about this issue then I would be thankful.

Re: Fixtures file overwting the data instead of adding as new record

I think that is fixtures by design, from the Docs:
"To ensure consistent data, the environment deletes the fixtures before running the load."

I'm not sure how you would insert new fixtures on top of existing ones though.