Upgrading to Rails 3.2.8 causes stack level too deep error with ActiveRecord

懵懂的女人 提交于 2019-12-12 22:48:37

问题


I am fairly new to Ruby however I am running into an issue which I am having trouble getting to the bottom of.

My simple application was working fine and then, after upgrading the Rails version to 3.2.8 I hit an issue when trying to query my database for records. This works fine when using Rails 3.0.7 but after upgrading to rails 3.2.8 it starts to fail with a Stack Level too deep error.

My model looks like this:

class Resource < ActiveRecord::Base 
  validates :title, :presence => true, 
                    :length => { :minimum => 5} 
  validates :link,  :presence => true 
  validates :date_submitted,  :presence => true 

  has_many :comments 

  validates_format_of :link, :with => URI::regexp(%w(http https)) 
  validates :link, :uniqueness => {:scope => :link, :message => "This item has already been submitted"} 
end 

And when I call Resource.all from the console this fails with the following error:

SystemStackError: stack level too deep from /home/tom/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/irb/workspace.rb:80 Maybe IRB bug!!

It also seems to happen with other models as well and the fact this worked fine before the upgrade seems to suggest it is something else. Does anyone have any ideas of where I should be looking - the error information is quite limited.

UPDATE: after doing a little more digging this seems to start to break when changing to Rails 3.2.1. Rails 3.2.0 and less - my application works fine - 3.2.1 or greater causes the stack level too deep issue.

UPDATE 2: Found the issue. I was using the SearchLogic gem which was causing the issue. Removing that from the GemFile solved my problems.

来源:https://stackoverflow.com/questions/12342691/upgrading-to-rails-3-2-8-causes-stack-level-too-deep-error-with-activerecord

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!