Sha256: b1a1b64ce9a339ffaf2dda103e798cb2c1c5554dc87cdf6cabdd6b7afe07cd77

Contents?: true

Size: 578 Bytes

Versions: 1

Compression:

Stored size: 578 Bytes

Contents

module Rails
  module Neoon
    extend self

    def load_models(models)
      models.each do |path|
        files = Dir.glob("#{path}/**/*.rb")
        files.sort.each do |file|
          load_model(file.gsub("#{path}/" , "").gsub(".rb", ""))
        end
      end
    end

    def preload_models(app)
      models = app.config.paths["app/models"]
      load_models(models) if ::Neoon.config.preload_models
    end

  private

    def load_model(file)
      begin
        require_dependency(file)
      rescue Exception => e
        puts e.message
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
neoon-0.0.3 lib/rails/neoon.rb