Skip to content

Commit

Permalink
Don't allow hobo_model without HoboFields.enable
Browse files Browse the repository at this point in the history
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]
  • Loading branch information
betelgeuse authored and bryanlarsen committed Sep 16, 2010
1 parent f699ce7 commit 0363484
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion hobo/lib/hobo/model.rb
Expand Up @@ -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)
Expand Down

0 comments on commit 0363484

Please sign in to comment.