Class: Lite::Report::Record
- Inherits:
-
Base
- Object
- Base
- Lite::Report::Record
show all
- Defined in:
- lib/lite/report/record.rb
Instance Method Summary
collapse
Methods inherited from Base
export, import, #initialize
Instance Method Details
#export ⇒ Object
7
8
9
10
|
# File 'lib/lite/report/record.rb', line 7
def export
generate_or_stream_export!
end
|
#import ⇒ Object
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/lite/report/record.rb', line 12
def import
assert_klass_data_option!
assign_import_csv_options!
@data = Lite::Report::Hash.import(@data, csv_options: @csv_options, data_options: @data_options)
.each do |row|
row.delete(:id) || row.delete('id')
(row['created_at'] ||= timestamp) if created_at_timestamp?
(row['updated_at'] ||= timestamp) if updated_at_timestamp?
end
klass.insert_all(@data, **@import_options)
end
|