Advertisement
Guest User

Untitled

a guest
Aug 3rd, 2015
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. Port.delete_all
  2. File.open("db_ports.txt", "r") do |ports|
  3. ports.read.each_line do |port|
  4. id, name, un_locode, bunker_surcharge, launch_tariff = port.chomp.split("|")
  5. Port.create!(:id => id, :name => name, :un_locode => un_locode, :bunker_surcharge => bunker_surcharge, :launch_tariff => launch_tariff)
  6. end
  7. end
  8.  
  9. port = Port.new(:name => name, :un_locode => un_locode, ... )
  10. port.id = id
  11. port.save!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement