lib/reform/form/active_model.rb in reform-1.0.4 vs lib/reform/form/active_model.rb in reform-1.1.0
- old
+ new
@@ -1,11 +1,13 @@
+require 'reform/form/active_model/model_validations'
+
module Reform::Form::ActiveModel
module FormBuilderMethods # TODO: rename to FormBuilderCompat.
def self.included(base)
base.class_eval do
extend ClassMethods # ::model_name
- features << FormBuilderMethods
+ register_feature FormBuilderMethods
end
end
module ClassMethods
def property(name, options={})
@@ -46,12 +48,12 @@
def self.included(base)
base.class_eval do
extend ClassMethods
- features << ActiveModel
+ register_feature ActiveModel
- delegate [:persisted?, :to_key, :to_param, :id] => :model
+ delegates :model, *[:persisted?, :to_key, :to_param, :id] # Uber::Delegates
def to_model # this is called somewhere in FormBuilder and ActionController.
self
end
end