active_record_to_csv 0.1.4 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -35,10 +35,12 @@ After a model object's attributes are collected, to_csv is called on the resulti
35
35
 
36
36
  class Date
37
37
  def to_csv
38
- strftime('%Y/%m/%d')
38
+ strftime('%Y-%m-%d')
39
39
  end
40
40
  end
41
41
 
42
+ Note that object.send(attribute_name) is used, so datetime fields will be returned as ActiveSupport::TimeWithZone objects.
43
+
42
44
  == TODO
43
45
 
44
46
  Options to specify columns to be included (currently, id and timestamp columns are excluded).
@@ -9,7 +9,7 @@ module ActiveRecordToCSV
9
9
  header_row = csv_columns.to_csv
10
10
  records_rows = all.map do |record|
11
11
  csv_columns.map do |column|
12
- value = record[column]
12
+ value = record.send(column)
13
13
  value = value.to_csv if value.respond_to?(:to_csv)
14
14
  value
15
15
  end.to_csv
@@ -1,3 +1,3 @@
1
1
  module ActiveRecordToCsv
2
- VERSION = "0.1.4"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: active_record_to_csv
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.4
5
+ version: 0.2.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - Jared Ning