Sha256: 09d68157949f75d5dd2e29c49d699308545a56b8e82b22ab650b350c7358baa6

Contents?: true

Size: 1.04 KB

Versions: 7

Compression:

Stored size: 1.04 KB

Contents

require 'active_model'
require 'active_record'
require 'active_support/core_ext'

module NinjaModel
  extend ActiveSupport::Autoload

  class NinjaModelError < StandardError; end

  class << self
    attr_accessor :logger

    def set_logger(logger)
      ::NinjaModel.logger = logger
    end

    def ninja_model?(symbol)
      #klass = symbol.to_s.camelize
      #klass = klass.singularize
      #klass = symbol.constantize
      symbol.ancestors.include?(NinjaModel::Base)
    end

    def configuration
      @config ||= ActiveSupport::OrderedOptions.new
    end
  end

  autoload :Attribute
  autoload :AttributeMethods
  autoload :Associations
  autoload :Adapters
  autoload :Base
  autoload :Callbacks
  autoload :Identity
  autoload :Persistence
  autoload :Predicate
  autoload :Reflection
  autoload :Relation
  autoload :Validation

  ActiveSupport.on_load(:active_record) do
    require 'ninja_model/rails_ext/active_record'
    include ActiveRecord::NinjaModelExtensions::ReflectionExt
  end
end

if defined?(Rails)
  require 'ninja_model/railtie'
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ninja-model-0.9.6 lib/ninja_model.rb
ninja-model-0.9.5 lib/ninja_model.rb
ninja-model-0.9.4 lib/ninja_model.rb
ninja-model-0.9.3 lib/ninja_model.rb
ninja-model-0.9.2 lib/ninja_model.rb
ninja-model-0.9.1 lib/ninja_model.rb
ninja-model-0.9.0 lib/ninja_model.rb