Module: DatabaseValidations::Rescuer
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/database_validations/lib/rescuer.rb
Instance Attribute Summary collapse
-
#_database_validations_fallback ⇒ Object
Returns the value of attribute _database_validations_fallback.
Instance Method Summary collapse
Instance Attribute Details
#_database_validations_fallback ⇒ Object
Returns the value of attribute _database_validations_fallback.
9 10 11 |
# File 'lib/database_validations/lib/rescuer.rb', line 9 def _database_validations_fallback @_database_validations_fallback end |
Instance Method Details
#create_or_update(*args, &block) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/database_validations/lib/rescuer.rb', line 16 def create_or_update(*args, &block) self._database_validations_fallback = false ActiveRecord::Base.connection.transaction(requires_new: true) { super } rescue ActiveRecord::InvalidForeignKey, ActiveRecord::RecordNotUnique => error raise error unless Helpers.handle_error!(self, error) raise ActiveRecord::RecordInvalid, self end |
#valid?(context = nil) ⇒ Boolean
11 12 13 14 |
# File 'lib/database_validations/lib/rescuer.rb', line 11 def valid?(context = nil) self._database_validations_fallback = true super(context) end |