Sha256: 8be633090599819c869d14798f821bb27b9ab3f4e6befc2048f5946b5eb07272
Contents?: true
Size: 1.01 KB
Versions: 5
Compression:
Stored size: 1.01 KB
Contents
# -*- encoding : utf-8 -*- module RademadeAdmin module Model class Graph include Singleton def add_pair(controller_name, inner) # Controller includes configuration for mapping model controller = LoaderService.const_get("rademade_admin/#{controller_name}_controller") controller.configuration.model(controller_name.classify) unless controller.model_name model = controller.model_class unless @model_infos[model.to_s] model_reflection = RademadeAdmin::Model::Reflection.new(model, controller_name) model_info = RademadeAdmin::Model::Info.new(model_reflection, controller.configuration, inner) @model_infos[model.to_s] = model_info end end def model_info(model) @model_infos[model.to_s] end def root_models @root_models ||= @model_infos.select { |_, model_info| not model_info.nested? }.values end private def initialize @model_infos = {} end end end end
Version data entries
5 entries across 5 versions & 1 rubygems