Last active
August 29, 2015 14:20
-
-
Save billie66/0dcb9d6491314b165967 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: UTF-8 | |
namespace :db do | |
desc "import some data to the users table" | |
task :users => :environment do | |
a = [] | |
File.open("lib/tasks/talk_production.sql", 'r') do |f| | |
a = f.read.strip.split(/\n/) | |
end | |
a.delete_at(0) | |
a.each do |e| | |
u = User.new | |
info = e.gsub(/\'/, '').split(',') | |
u.name = info.delete_at(1) | |
u.email = info.delete_at(2) | |
#u.password_digest = info.delete_at(3) | |
u.token = info.delete_at(4) | |
u.save | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment