Using Rails 4,i want to apply import and export functionality,when i click on EXPORT TO TEXT link all my table data which is present in table is downloaded to text. Same functionality i have applied for excel but now i want it for text.So i don't have any idea on how may i do it and what i may write in controller.
This is my previous code which i have followed from railcast.
def import_machine_attendance
@emp = Employee.all
respond_to do |format|
format.html
format.csv { send_data @emp.to_csv }
format.xls
end
end
<%= link_to "CSV", import_machine_attendance_machine_attendances_path(format: "csv") %> |