I am trying to generate CSV like blow.
students = Student.find(:all, :include =>
[:application, :person], :conditions => conditions)
csv_string = FasterCSV.generate do |csv|
csv << %w["student_status", "semester", "id_number",
students.each do |c|
csv << [c.status, c.application.semester_desc,
c.person.id_number, c.person.last_name, c.person.first_name]
If the student does not have a record of application or person. Rails
complains about null association.
I can create conditional statement e.g., "if c,application" to
workaround null, but there are lots of fields in my real code do not
want to waste my time for putting if statement.
Are there any way so that I can just insert null or empty string when
association is null?
Thanks in advance.