File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ class Configuration
2121 :top_level_meta_record_count_key ,
2222 :top_level_meta_include_page_count ,
2323 :top_level_meta_page_count_key ,
24+ :allow_transactions ,
2425 :exception_class_whitelist ,
2526 :always_include_to_one_linkage_data ,
2627 :always_include_to_many_linkage_data ,
@@ -80,6 +81,10 @@ def initialize
8081 # for a Resource.
8182 self . default_processor_klass = JSONAPI ::Processor
8283
84+ # Allows transactions for creating and updating records
85+ # Set this to false if your backend does not support transactions (e.g. Mongodb)
86+ self . allow_transactions = true
87+
8388 # Formatter Caching
8489 # Set to false to disable caching of string operations on keys and links.
8590 self . cache_formatters = true
@@ -172,6 +177,8 @@ def default_processor_klass=(default_processor_klass)
172177
173178 attr_writer :top_level_meta_page_count_key
174179
180+ attr_writer :allow_transactions
181+
175182 attr_writer :exception_class_whitelist
176183
177184 attr_writer :always_include_to_one_linkage_data
Original file line number Diff line number Diff line change @@ -16,9 +16,10 @@ def process(operations)
1616 # Use transactions if more than one operation and if one of the operations can be transactional
1717 # Even if transactional transactions won't be used unless the derived OperationsProcessor supports them.
1818 transactional = false
19+
1920 operations . each do |operation |
2021 transactional |= operation . transactional?
21- end
22+ end if JSONAPI . configuration . allow_transactions
2223
2324 transaction ( transactional ) do
2425 # Links and meta data global to the set of operations
You can’t perform that action at this time.
0 commit comments