Reputation: 10673
I'm trying to create some seed data and got this code from Railcasts. I've modified it slightly but doesn't seem to be working when i run bundle exec rake db:seed from the terminal. I get the following error in the terminal...
wrong number of arguments (0 for 1)
Below is my code in the seeds.rb file to populate the table. Is there a silly mistake in there somewhere?
require 'open-uri'
International.delete.all
open("international.txt") do |countries|
countries.read.each_line do |data|
code, country, currency = data.chomp.split("|")
International.create!(:code => code, :country => country, :currency => currency)
end
end
and my text file (stored in the same directory as the seeds.rb file is...
AU|Australia|AUD
CA|Canada|CAD
GB|United Kingdom|GBP
US|United States|USD
Upvotes: 2
Views: 1421