title: Rails CSV generator - undefined method `collect' for Mon, 17 Jun 2019 14:16:10 CEST +02:00:Time in
body: <p>I've got CSV generetor for admin logs. When I run a test I've got an error</p>
  
  <blockquote>
    <p>1) CsvAdminLogData::CsvAdminLogGenerator creates CSV file with proper value
        Failure/Error: csv &lt;&lt; admin_log.created_at</p>
    
    <p>NoMethodError:
           undefined method `collect' for Mon, 17 Jun 2019 14:16:10 CEST +02:00:Time</p>
  </blockquote>
  
  <pre><code>def call
    CSV.open(target_file, 'w', headers: LOG_HEADERS, encoding: 'UTF-8') do |csv|
      AdminPanelLog.dates_between(start_date, end_date).find_each do |admin_log|
        csv &lt;&lt; admin_log.created_at
        csv &lt;&lt; admin_log.action_type
        csv &lt;&lt; admin_log.admin_email
        csv &lt;&lt; admin_log.old_data
        csv &lt;&lt; admin_log.new_data
      end
    end
  end
  </code></pre>
  
  <p>I've try to something like <code>admin_log.created_at.to_s</code> but without any results. In this case I can't use <code>&lt;&lt;</code> to add this data to CSV file?</p>
  
  <p>EDIT:</p>
  
  <p>If I comment <code># csv &lt;&lt; admin_log.action_type</code> I will get the same error for another row</p>
  
  <blockquote>
    <p>Failure/Error: csv &lt;&lt; admin_log.action_type
        NoMethodError:
           undefined method `collect' for "New":String</p>
  </blockquote>