lib/simple_model/base.rb in simple_model-1.2.2 vs lib/simple_model/base.rb in simple_model-1.2.3

- old
+ new

@@ -1,22 +1,22 @@ -module SimpleModel +module SimpleModel # Require all that active support we know and love - require 'active_support/time' - require 'active_support/core_ext/class/attribute' - require 'active_support/core_ext/class/attribute_accessors' - require 'active_support/core_ext/class/delegating_attributes' - require 'active_support/core_ext/class/attribute' - require 'active_support/core_ext/array/extract_options' - require 'active_support/core_ext/hash/deep_merge' - require 'active_support/core_ext/hash/indifferent_access' - require 'active_support/core_ext/hash/slice' - require 'active_support/core_ext/string/behavior' - require 'active_support/core_ext/kernel/singleton_class' - require 'active_support/core_ext/module/delegation' - require 'active_support/core_ext/module/introspection' - require 'active_support/core_ext/object/duplicable' - require 'active_support/core_ext/object/blank' +require 'active_support/time' +require 'active_support/core_ext/class/attribute' +require 'active_support/core_ext/class/attribute_accessors' +require 'active_support/core_ext/class/delegating_attributes' +require 'active_support/core_ext/class/attribute' +require 'active_support/core_ext/array/extract_options' +require 'active_support/core_ext/hash/deep_merge' +require 'active_support/core_ext/hash/indifferent_access' +require 'active_support/core_ext/hash/slice' +require 'active_support/core_ext/string/behavior' +require 'active_support/core_ext/kernel/singleton_class' +require 'active_support/core_ext/module/delegation' +require 'active_support/core_ext/module/introspection' +require 'active_support/core_ext/object/duplicable' +require 'active_support/core_ext/object/blank' # == SimpleModel::Base # # Provides an interface for any class to build tableless models. # @@ -74,16 +74,12 @@ class Base include SimpleModel::Attributes include SimpleModel::ErrorHelpers #Use ActiveModel Resources - include ActiveModel::Validations - include ActiveModel::Conversion - extend ActiveModel::Naming - extend ActiveModel::Callbacks - include ActiveModel::Validations::Callbacks + define_model_callbacks :save, :update, :create, :destroy class << self def save(*methods) @@ -120,10 +116,10 @@ completed = ran unless ran end if completed self.persisted = true @previously_changed = changes - @changed_attributes.clear + @changed_attributes.clear else self.send(options[:rollback]) unless options[:rollback].blank? end else completed = false \ No newline at end of file