From 03634844d8e5e00767e4bcbe542a51a949362371 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petteri=20R=C3=A4ty?= Date: Fri, 16 Jul 2010 00:32:27 +0300 Subject: [PATCH] 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] --- hobo/lib/hobo/model.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hobo/lib/hobo/model.rb b/hobo/lib/hobo/model.rb index 4cd754685..7c21b222f 100644 --- a/hobo/lib/hobo/model.rb +++ b/hobo/lib/hobo/model.rb @@ -40,7 +40,9 @@ def inherited(klass) end end end - + + # https://hobo.lighthouseapp.com/projects/8324/tickets/762-hobo_model-outside-a-full-rails-env-can-lead-to-stack-level-too-deep + raise HoboError, "HoboFields.enable has not been called" unless base.respond_to?(:fields) base.fields(false) # force hobofields to load included_in_class_callbacks(base)