Skip to content

Commit 1a8cd10

Browse files
committed
fix dsl sql_transaction
1 parent b32f55d commit 1a8cd10

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

lib/csv_importer/config.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@ class Config
99
attribute :when_invalid, Symbol, default: proc { :skip }
1010
attribute :after_build_blocks, Array[Proc], default: []
1111
attribute :after_save_blocks, Array[Proc], default: []
12+
attribute :sql_transaction, Symbol, default: proc { :all_rows }
1213

1314
def initialize_copy(orig)
1415
super
1516
self.column_definitions = orig.column_definitions.dup
1617
self.identifiers = orig.identifiers.dup
1718
self.after_save_blocks = orig.after_save_blocks.dup
1819
self.after_build_blocks = orig.after_build_blocks.dup
20+
self.sql_transaction = orig.sql_transaction.dup
1921
end
2022

2123
def after_build(block)

lib/csv_importer/dsl.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,9 @@ def after_build(&block)
2727
def after_save(&block)
2828
config.after_save(block)
2929
end
30+
31+
def sql_transaction(behavior)
32+
config.sql_transaction = behavior
33+
end
3034
end
3135
end

0 commit comments

Comments
 (0)