Exception: ActiveRecord::DeleteRestrictionError
- Inherits:
-
ActiveRecordError
- Object
- StandardError
- ActiveRecordError
- ActiveRecord::DeleteRestrictionError
- Defined in:
- lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.4/lib/active_record/associations.rb
Overview
This error is raised when trying to destroy a parent instance in N:1 or 1:1 associations (has_many, has_one) when there is at least 1 child associated instance. ex: if @project.tasks.size > 0, DeleteRestrictionError will be raised when trying to destroy @project
Instance Method Summary collapse
-
#initialize(name = nil) ⇒ DeleteRestrictionError
constructor
:nodoc:.
Constructor Details
#initialize(name = nil) ⇒ DeleteRestrictionError
:nodoc:
241 242 243 244 245 246 247 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.4/lib/active_record/associations.rb', line 241 def initialize(name = nil) if name super("Cannot delete record because of dependent #{name}") else super("Delete restriction error.") end end |