Hi,
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",
"last_name", "first_name"]
      students.each do |c|
        csv << [c.status, c.application.semester_desc,
c.person.id_number, c.person.last_name, c.person.first_name]
      end
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.
Glen
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---