i want to do (export to CSV) in the form of fetching first 50 students and next 50 students and so on, in seperate files. i have tried with the below given code, and i dont know how to generate loop, please provide some code to do the process.
@count =0
if @count == 0
students = Student.find(:all,:order => 'name', :limit => 50)
@count = @count+1
else
students = Student.find(:all,:order => 'name', :limit => 50, :offset => 50)
@count = @count+1
on clicking export to csv, it should fetch 1st 50 students, next 50 students and so on in different files.
please, tell how to add loop to above code so that it fetches every 50 students, in seperate files