неопределенный метод type_cast для ActiveRecord и уровень стека слишком глубокий - PullRequest
0 голосов
/ 24 сентября 2018

У меня есть следующий метод:

def parent_item_id=(item_id)
  if new_record?
    self[:parent_item_id] = item_id
  elsif self[:parent_item_id] != self.class.columns_hash['parent_item_id'].type_cast(item_id)
    remove_from_list
    self[:parent_item_id] = item_id
  end
end

, который дает мне ошибку:

undefined method `type_cast' for #<ActiveRecord::ConnectionAdapters::Column>

Поэтому я применил то, что было предложено здесь :

def parent_item_id=(item_id)
  if new_record?
    self[:parent_item_id] = item_id
  # CHANGES IN THE LINE BELOW:
  elsif self[:parent_item_id] != ActiveRecord::Base.connection.type_cast(item_id, self.class.columns_hash['parent_item_id']) # <-- THIS
    remove_from_list
    self[:parent_item_id] = item_id
  end
end

но тогда я получаю:

SystemStackError:
       stack level too deep 

Я только что обновился до рельсов 5.0.7 и ruby ​​2.5.1

Backtrace:

 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/scoping.rb:79:in `value_for'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/per_thread_registry.rb:53:in `value_for'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/scoping.rb:14:in `current_scope'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/scoping/named.rb:25:in `all'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/associations/association.rb:124:in `target_scope'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/associations/association.rb:86:in `scope'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/associations/collection_association.rb:429:in `scope'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/associations/collection_association.rb:348:in `empty?'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/associations/has_many_association.rb:50:in `empty?'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/associations/collection_association.rb:359:in `any?'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/associations/collection_proxy.rb:846:in `any?'
 # ./app/models/report_section.rb:16:in `parent_sections_cannot_have_parents'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:382:in `block in make_lambda'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:169:in `block (2 levels) in halting'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:547:in `block (2 levels) in default_terminator'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:546:in `catch'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:546:in `block in default_terminator'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:170:in `block in halting'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:454:in `block in call'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:454:in `each'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:454:in `call'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:101:in `__run_callbacks__'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:750:in `_run_validate_callbacks'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activemodel-5.0.7/lib/active_model/validations.rb:408:in `run_validations!'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activemodel-5.0.7/lib/active_model/validations/callbacks.rb:113:in `block in run_validations!'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:126:in `call'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:506:in `block (2 levels) in compile'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:455:in `call'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:101:in `__run_callbacks__'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:750:in `_run_validation_callbacks'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activemodel-5.0.7/lib/active_model/validations/callbacks.rb:113:in `run_validations!'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activemodel-5.0.7/lib/active_model/validations.rb:338:in `valid?'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/validations.rb:65:in `valid?'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/validations.rb:82:in `perform_validations'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/validations.rb:44:in `save'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/attribute_methods/dirty.rb:22:in `save'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/transactions.rb:319:in `block (2 levels) in save'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/transactions.rb:395:in `block in with_transaction_returning_status'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/connection_adapters/abstract/database_statements.rb:230:in `transaction'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/transactions.rb:211:in `transaction'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/transactions.rb:392:in `with_transaction_returning_status'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/transactions.rb:319:in `block in save'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/transactions.rb:334:in `rollback_active_record_state!'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/transactions.rb:318:in `save'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/suppressor.rb:41:in `save'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/acts_as_list-0.9.16/lib/acts_as_list/active_record/acts/list.rb:217:in `set_list_position'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/acts_as_list-0.9.16/lib/acts_as_list/active_record/acts/list.rb:128:in `remove_from_list'
 # ./app/models/report_section.rb:29:in `parent_report_section_id='
 # /usr/local/rvm/gems/ruby-2.5.1/gems/acts_as_list-0.9.16/lib/acts_as_list/active_record/acts/list.rb:466:in `block in check_scope'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/acts_as_list-0.9.16/lib/acts_as_list/active_record/acts/list.rb:466:in `each'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/acts_as_list-0.9.16/lib/acts_as_list/active_record/acts/list.rb:466:in `check_scope'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:382:in `block in make_lambda'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:150:in `block (2 levels) in halting_and_conditional'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:770:in `block (2 levels) in deprecated_false_terminator'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:769:in `catch'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:769:in `block in deprecated_false_terminator'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:151:in `block in halting_and_conditional'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:454:in `block in call'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:454:in `each'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:454:in `call'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:101:in `__run_callbacks__'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:750:in `_run_update_callbacks'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/callbacks.rb:306:in `_update_record'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/timestamp.rb:81:in `_update_record'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/persistence.rb:548:in `create_or_update'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/callbacks.rb:298:in `block in create_or_update'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:126:in `call'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:506:in `block (2 levels) in compile'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:455:in `call'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:101:in `__run_callbacks__'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:750:in `_run_save_callbacks'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/callbacks.rb:298:in `create_or_update'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/persistence.rb:129:in `save'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/validations.rb:44:in `save'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/attribute_methods/dirty.rb:22:in `save'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/transactions.rb:319:in `block (2 levels) in save'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/transactions.rb:395:in `block in with_transaction_returning_status'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/connection_adapters/abstract/database_statements.rb:230:in `transaction'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/transactions.rb:211:in `transaction'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/transactions.rb:392:in `with_transaction_returning_status'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/transactions.rb:319:in `block in save'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/transactions.rb:334:in `rollback_active_record_state!'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/transactions.rb:318:in `save'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/suppressor.rb:41:in `save'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/acts_as_list-0.9.16/lib/acts_as_list/active_record/acts/list.rb:217:in `set_list_position'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/acts_as_list-0.9.16/lib/acts_as_list/active_record/acts/list.rb:128:in `remove_from_list'
 # ./app/models/report_section.rb:29:in `parent_report_section_id='
 # /usr/local/rvm/gems/ruby-2.5.1/gems/acts_as_list-0.9.16/lib/acts_as_list/active_record/acts/list.rb:466:in `block in check_scope'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/acts_as_list-0.9.16/lib/acts_as_list/active_record/acts/list.rb:466:in `each'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/acts_as_list-0.9.16/lib/acts_as_list/active_record/acts/list.rb:466:in `check_scope'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:382:in `block in make_lambda'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:150:in `block (2 levels) in halting_and_conditional'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:770:in `block (2 levels) in deprecated_false_terminator'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:769:in `catch'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:769:in `block in deprecated_false_terminator'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:151:in `block in halting_and_conditional'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:454:in `block in call'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:454:in `each'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:454:in `call'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:101:in `__run_callbacks__'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:750:in `_run_update_callbacks'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/callbacks.rb:306:in `_update_record'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/timestamp.rb:81:in `_update_record'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/persistence.rb:548:in `create_or_update'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/callbacks.rb:298:in `block in create_or_update'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:126:in `call'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:506:in `block (2 levels) in compile'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:455:in `call'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:101:in `__run_callbacks__'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:750:in `_run_save_callbacks'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/callbacks.rb:298:in `create_or_update'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/persistence.rb:129:in `save'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/validations.rb:44:in `save'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/attribute_methods/dirty.rb:22:in `save'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/transactions.rb:319:in `block (2 levels) in save'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/transactions.rb:395:in `block in with_transaction_returning_status'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/connection_adapters/abstract/database_statements.rb:230:in `transaction'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/transactions.rb:211:in `transaction'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/transactions.rb:392:in `with_transaction_returning_status'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/transactions.rb:319:in `block in save'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/transactions.rb:334:in `rollback_active_record_state!'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/transactions.rb:318:in `save'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/suppressor.rb:41:in `save'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/acts_as_list-0.9.16/lib/acts_as_list/active_record/acts/list.rb:217:in `set_list_position'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/acts_as_list-0.9.16/lib/acts_as_list/active_record/acts/list.rb:128:in `remove_from_list'
 # ./app/models/report_section.rb:29:in `parent_report_section_id='
 # /usr/local/rvm/gems/ruby-2.5.1/gems/acts_as_list-0.9.16/lib/acts_as_list/active_record/acts/list.rb:466:in `block in check_scope'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/acts_as_list-0.9.16/lib/acts_as_list/active_record/acts/list.rb:466:in `each'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/acts_as_list-0.9.16/lib/acts_as_list/active_record/acts/list.rb:466:in `check_scope'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:382:in `block in make_lambda'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:150:in `block (2 levels) in halting_and_conditional'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:770:in `block (2 levels) in deprecated_false_terminator'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:769:in `catch'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:769:in `block in deprecated_false_terminator'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:151:in `block in halting_and_conditional'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:454:in `block in call'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:454:in `each'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:454:in `call'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:101:in `__run_callbacks__'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:750:in `_run_update_callbacks'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/callbacks.rb:306:in `_update_record'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/timestamp.rb:81:in `_update_record'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/persistence.rb:548:in `create_or_update'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/callbacks.rb:298:in `block in create_or_update'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:126:in `call'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:506:in `block (2 levels) in compile'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:455:in `call'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:101:in `__run_callbacks__'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:750:in `_run_save_callbacks'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/callbacks.rb:298:in `create_or_update'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/persistence.rb:129:in `save'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/validations.rb:44:in `save'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/attribute_methods/dirty.rb:22:in `save'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/transactions.rb:319:in `block (2 levels) in save'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/transactions.rb:395:in `block in with_transaction_returning_status'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/connection_adapters/abstract/database_statements.rb:230:in `transaction'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/transactions.rb:211:in `transaction'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/transactions.rb:392:in `with_transaction_returning_status'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/transactions.rb:319:in `block in save'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/transactions.rb:334:in `rollback_active_record_state!'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/transactions.rb:318:in `save'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/suppressor.rb:41:in `save'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/acts_as_list-0.9.16/lib/acts_as_list/active_record/acts/list.rb:217:in `set_list_position'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/acts_as_list-0.9.16/lib/acts_as_list/active_record/acts/list.rb:128:in `remove_from_list'
 # ./app/models/report_section.rb:29:in `parent_report_section_id='
 # /usr/local/rvm/gems/ruby-2.5.1/gems/acts_as_list-0.9.16/lib/acts_as_list/active_record/acts/list.rb:466:in `block in check_scope'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/acts_as_list-0.9.16/lib/acts_as_list/active_record/acts/list.rb:466:in `each'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/acts_as_list-0.9.16/lib/acts_as_list/active_record/acts/list.rb:466:in `check_scope'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:382:in `block in make_lambda'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:150:in `block (2 levels) in halting_and_conditional'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:770:in `block (2 levels) in deprecated_false_terminator'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:769:in `catch'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:769:in `block in deprecated_false_terminator'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:151:in `block in halting_and_conditional'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:454:in `block in call'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:454:in `each'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:454:in `call'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:101:in `__run_callbacks__'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:750:in `_run_update_callbacks'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/callbacks.rb:306:in `_update_record'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/timestamp.rb:81:in `_update_record'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/persistence.rb:548:in `create_or_update'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/callbacks.rb:298:in `block in create_or_update'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:126:in `call'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:506:in `block (2 levels) in compile'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:455:in `call'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:101:in `__run_callbacks__'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:750:in `_run_save_callbacks'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/callbacks.rb:298:in `create_or_update'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/persistence.rb:129:in `save'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/validations.rb:44:in `save'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/attribute_methods/dirty.rb:22:in `save'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/transactions.rb:319:in `block (2 levels) in save'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/transactions.rb:395:in `block in with_transaction_returning_status'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/connection_adapters/abstract/database_statements.rb:230:in `transaction'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/transactions.rb:211:in `transaction'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/transactions.rb:392:in `with_transaction_returning_status'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/transactions.rb:319:in `block in save'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/transactions.rb:334:in `rollback_active_record_state!'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/transactions.rb:318:in `save'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activerecord-5.0.7/lib/active_record/suppressor.rb:41:in `save'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/acts_as_list-0.9.16/lib/acts_as_list/active_record/acts/list.rb:217:in `set_list_position'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/acts_as_list-0.9.16/lib/acts_as_list/active_record/acts/list.rb:128:in `remove_from_list'
 # ./app/models/report_section.rb:29:in `parent_report_section_id='
 # /usr/local/rvm/gems/ruby-2.5.1/gems/acts_as_list-0.9.16/lib/acts_as_list/active_record/acts/list.rb:466:in `block in check_scope'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/acts_as_list-0.9.16/lib/acts_as_list/active_record/acts/list.rb:466:in `each'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/acts_as_list-0.9.16/lib/acts_as_list/active_record/acts/list.rb:466:in `check_scope'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:382:in `block in make_lambda'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:150:in `block (2 levels) in halting_and_conditional'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:770:in `block (2 levels) in deprecated_false_terminator'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:769:in `catch'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:769:in `block in deprecated_false_terminator'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:151:in `block in halting_and_conditional'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:454:in `block in call'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:454:in `each'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7/lib/active_support/callbacks.rb:454:in `call'
 # /usr/local/rvm/gems/ruby-2.5.1/gems/activesupport-

Спасибо

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...