Hi,
This code is not working in Production. I am unable to create users when
importing CSV file.
def import_from_csv
if request.post? && (params[:csv_import].kind_of?(StringIO) ||
params[:csv_import].kind_of?(Tmpfile))
@parsed_file = CSV::Reader.parse(params[:csv_import])
n = 0
@parsed_file.each do |row|
@user = User.new {|user|
# login is the first element of each line
user.login = row[0]
# assign an auto-generated password
user.password = User.generate_random_password
}
if @user.save
n = n+1
GC.start if n%50==0
end
end
end
users.csv file:
[email protected]
[email protected]
[email protected]
[email protected]
The file importing works fine in development(localhost), but not on live
site
Please help me .