Hi
I am using seed_fu to seed initial data to tables
(GitHub - mbleigh/seed-fu: Advanced seed data handling for Rails, combining the best practices of several methods together.) . And in db/fixtures/state.rb
I have values like (I am filling only two data for simplicity)
State.seed_many(:name, :abbr,:fips,:country_id, [
{ :name => “Alberta”, :abbr => ‘AB’,:fips => ‘01’, :country_id =>
2 },
{ :name => “Alaska”, :abbr => ‘AK’,:fips => ‘02’, :country_id => 1
}
])
It works and when I do select * from states; I get result as
±----±-----±----------------------±-----±-----------+
| id | abbr | name | fips | country_id |
±----±-----±----------------------±-----±-----------+
| 1 | AB | Alberta | 01 | 2 |
| 2 | AK | Alaska | 02 | 1 |
But now I modified state.rb as
State.seed_many(:name, :abbr,:fips,:country_id, [
{ :name => “Alberta”, :abbr => ‘AB’,:fips => ‘01’, :country_id =>
2 },
{ :name => “Alaska”, :abbr => ‘AK’,:fips => ‘02’, :country_id => 1
}
])
State.destroy_all
State.create(:id => 1,:name => “Alabama”, :abbr => ‘AL’,:fips => ‘01’,
:country_id => 1)
And now when I do select * from states; I get unexpected result as
±----±-----±----------------------±-----±-----------+
| id | abbr | name | fips | country_id |
±----±-----±----------------------±-----±-----------+
| 5 | AL | Alabama | 01 | 1 |
What I expect was id=1 But I got id as 5 . Why this ?
Thanks in advance
Tom