我正在尝试使用rails中的rspec进行单元测试。但是,当我尝试将对象保存到我的测试数据库时,我在控制台中遇到以下错误。
这是输出:
test = my_object.new(id: 3000, name: "nameTest", last_name: "testLast", company: "testCompany", phone: "testPhone", created_at: DateTime.now, email: "test@test.fr", message: "MY_TEST", status: SpecialSearchesConstants::NEW)
2.2.2 :002 > test.valid? => true
2.2.2 :003 > test.save
(0.2ms) BEGIN
(0.3ms) ROLLBACK
SystemStackError: stack level too deep from
/home/ubuntu/.rvm/gems/ruby-2.2.2/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:455:in `block in make_lambda' from
/home/ubuntu/.rvm/gems/ruby-2.2.2/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:192:in `call' from
/home/ubuntu/.rvm/gems/ruby-2.2.2/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:192:in `block in simple' (...)
谷歌搜索后,似乎这个错误发生在recurcivity错误。但是,我的代码中没有递归性。
那么,有没有办法确切地知道问题的位置,或者是否存在其他可能导致“堆栈级别太深”的问题?