Hello,
I’m trying to load data into my mysql table using the following:
============ load_codes_data.rb ============
require ‘active_record/fixtures’
class LoadCodesData < ActiveRecord::Migration
def self.up
down
directory = File.join(File.dirname(“MY_DIR_NAME”), “data”)
Fixtures.create_fixtures(directory, “codes”)
end
def self.down
Code.delete_all
end
end
and here’s the yaml file:
=============== codes.yml ===================
I:
seq: 1
cat: source
description: Member
II:
seq: 2
cat: source
description: Friends or Family
III:
seq: 3
cat: source
description: Book
IV:
seq: 4
cat: source
description: Search Engine
V:
seq: 5
cat: source
description: Magazine
VI:
seq: 6
cat: source
description: Other
…
…
Here’s my question.
Codes table has the three fields you see in the yaml file and a unique
id field that gets populated automatically and gets assigned a random
non-sequential numbers. I would like for it to get sequential ids
assigned. I’ve searched for a while, but haven’t come across a
solution… Can anyone help?
Thanks,
Kumi