Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Port.delete_all
- File.open("db_ports.txt", "r") do |ports|
- ports.read.each_line do |port|
- id, name, un_locode, bunker_surcharge, launch_tariff = port.chomp.split("|")
- Port.create!(:id => id, :name => name, :un_locode => un_locode, :bunker_surcharge => bunker_surcharge, :launch_tariff => launch_tariff)
- end
- end
- port = Port.new(:name => name, :un_locode => un_locode, ... )
- port.id = id
- port.save!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement