Sha256: bbea8e966d89d06104d9aecac91524764046de68a9dce982d4dc58e9f05fdb54

Contents?: true

Size: 879 Bytes

Versions: 2

Compression:

Stored size: 879 Bytes

Contents

module Hyperloop
  define_setting :public_model_directories, ['app/models/public', 'app/hyperloop/models']
end

module ActiveRecord
  # adds method to get the HyperMesh public column types
  # for now we are just getting all models column types, but we should
  # look through the public folder, and just get those models.
  # this works because the public folder is currently required to be eaer loaded.
  class Base
    def self.public_columns_hash
      return @public_columns_hash if @public_columns_hash
      Hyperloop.public_model_directories.each do |dir|
        Dir.glob(Rails.root.join("#{dir}/*.rb")).each do |file|
          require_dependency(file)
        end
      end
      @public_columns_hash = {}
      descendants.each do |model|
        @public_columns_hash[model.name] = model.columns_hash rescue nil
      end
      @public_columns_hash
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hyper-mesh-0.6.0 lib/reactive_record/active_record/public_columns_hash.rb
hyper-mesh-0.5.4 lib/reactive_record/active_record/public_columns_hash.rb