lib/redis-model-extension.rb in redis-model-extension-0.4.0 vs lib/redis-model-extension.rb in redis-model-extension-0.4.1

- old
+ new

@@ -1,58 +1,57 @@ # -*- encoding : utf-8 -*- require 'pp' require 'yaml' require 'json' require 'redis' +require 'hashr' require 'active_model' require 'active_support' require 'active_support/inflector' require 'active_support/inflector/inflections' require 'active_support/core_ext/hash/keys' require 'active_support/core_ext/hash/indifferent_access' require 'active_support/core_ext/object/blank' -require 'active_support/core_ext/class/inheritable_attributes' require 'string_to_bool' require 'database' module RedisModelExtension extend ActiveSupport::Concern + #include all needed modules directly into main class - def self.included(base) - base.class_eval do - extend ClassInitialize - extend ClassOldInitialize - extend ClassConfig - extend ClassGetFind - extend ClassRedisKey - extend ClassCreate - extend ClassValidations - extend ClassAutoincrementId + included do + extend ClassInitialize + extend ClassOldInitialize + extend ClassConfig + extend ClassGetFind + extend ClassRedisKey + extend ClassCreate + extend ClassValidations + extend ClassAutoincrementId - include Initialize - include ActiveModelIntegration - include Attributes - include AutoincrementId - include RedisKey - include StoreKeys - include Config - include SaveDestroy - include Validations - include ValueTransform - end + include Initialize + include ActiveModelIntegration + include Attributes + include AutoincrementId + include RedisKey + include StoreKeys + include Config + include SaveDestroy + include Validations + include ValueTransform end module ActiveModelIntegration - def self.included(base) - base.class_eval do - include ActiveModel::AttributeMethods - include ActiveModel::Validations - include ActiveModel::Naming - include ActiveModel::Conversion + extend ActiveSupport::Concern - extend ActiveModel::Callbacks - define_model_callbacks :save, :destroy, :create - end + included do + include ActiveModel::AttributeMethods + include ActiveModel::Validations + include ActiveModel::Naming + include ActiveModel::Conversion + + extend ActiveModel::Callbacks + define_model_callbacks :save, :destroy, :create end end end