मैं CS12 फ़ाइल को पार्स करने और डेटाबेस तालिका में सामग्री जोड़ने के लिए this tutorial से कोड का उपयोग कर रहा हूं। मैं CSV फ़ाइल की पहली पंक्ति को कैसे अनदेखा करूं? नियंत्रक कोड के नीचे है:सीएसवी पार्स रेल पर पहली पंक्ति को अनदेखा करें
def csv_import
@parsed_file=CSV::Reader.parse(params[:dump][:file])
n = 0
@parsed_file.each do |row|
s = Student.new
s.name = row[0]
s.cid = row[1]
s.year_id = find_year_id_from_year_title(row[2])
if s.save
n = n+1
GC.start if n%50==0
end
flash.now[:message] = "CSV Import Successful, #{n} new students added to the database."
end
redirect_to(students_url)
end
आदेश एन अतिरिक्त तुलना – baash05