I suppose you want use the omap YAML type. Read about it in
http://api.rubyonrails.org/classes/Fixtures.html and in
http://yaml.org/type/omap.html.

Regards.

Franco Catena.

On Jul 13, 12:34 pm, khagimoto <kumi.hagim...@gmail.com> wrote:
> 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
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to