Module: JobContracts::ReadOnlyContract::ContractablePrepends
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/job_contracts/contracts/read_only_contract.rb
Instance Method Summary collapse
Instance Method Details
#perform(*args) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/job_contracts/contracts/read_only_contract.rb', line 10 def perform(*args) contract = contracts.find { |c| c.is_a?(ReadOnlyContract) } if contract.should_enforce?(self) ActiveRecord::Base.while_preventing_writes do super end else super end rescue ActiveRecord::ReadOnlyError => error @read_only_error = error end |