hobo_model outside a full rails env can lead to stack level too deep
Reported by Betelgeuse | July 15th, 2010 @ 09:51 PM
While trying to write some rubydoctests for Hobo I stumbled upon loading hobo causing a stack level too deep so most likely an endless loop. I also remember seeing stack level too deep issues on mailing lists so maybe fixing this will help them too. If this code is faulty in that hobo_model can't be made to work with it then for developer sanity it should give a meaningful error message:
require 'active_record'
ActiveRecord::ActiveRecordError
require 'action_view'
require 'action_controller'
RAILS_ROOT='.'
ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :database => ":memory:")
require 'will_paginate/finder'
$:.unshift 'hobo/lib'
require 'hobo'
require 'hobo/model'
class Unexisting < ActiveRecord::Base
hobo_model
fields do
end
end
This can be run inside a clone of a git repo.
betelgeuse@pena ~/hobo/hobo-pristine $ ruby noclass.rb
./hobo/lib/hobo/model.rb:343:in `method_missing': stack level too deep (SystemStackError)
from ./hobo/lib/hobo/model.rb:345:in `method_missing'
from ./hobo/lib/hobo/model.rb:46:in `included'
from ./hobo/lib/hobo/model.rb:124:in `include'
from ./hobo/lib/hobo/model.rb:124:in `hobo_model'
from noclass.rb:12
Comments and changes to this ticket
-
Betelgeuse November 1st, 2010 @ 06:08 PM
- State changed from new to resolved
(from [03634844d8e5e00767e4bcbe542a51a949362371]) Don't allow hobo_model without HoboFields.enable
Calling hobo_model in a model class body without having called
HoboFields.enable previously results in a SystemStackError with message
stack level too deep. For this reason query if fields method is
available and throw a better error message. [#762 state:resolved]
http://github.com/tablatom/hobo/commit/03634844d8e5e00767e4bcbe542a...
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป
People watching this ticket
Tags
Referenced by
- 762 hobo_model outside a full rails env can lead to stack level too deep Calling hobo_model in a model class body without having c...