diff --git a/hobo/lib/hobo/model.rb b/hobo/lib/hobo/model.rb index 3ecbc5910..de3cfe77d 100644 --- a/hobo/lib/hobo/model.rb +++ b/hobo/lib/hobo/model.rb @@ -33,17 +33,6 @@ class << base alias_method_chain :attr_accessor, :creator_metadata alias_method_chain :has_one, :new_method - - # eval avoids the ruby 1.9.2 "super from singleton method ..." error - eval %( - def inherited(klass) - super - fields(false) do - Hobo.register_model(klass) - field(klass.inheritance_column, :string) - end - end - ) end base.fields(false) # force hobo_fields to load @@ -172,6 +161,18 @@ def field_added(name, type, args, options) send(:login_attribute=, name.to_sym, validate) if options.delete(:login) && respond_to?(:login_attribute=) end + # eval avoids the ruby 1.9.2 "super from singleton method ..." error + eval %( + def inherited(klass) + super + Hobo::Model.register_model(klass) + # TODO: figure out when this is needed, as Hobofields already does this + fields(false) do + field(klass.inheritance_column, :string) + end + end + ) + private def attrib_names