Sha256: 5b97fa5cca723543d847af6fc0376f93e25fc1ce007c5c118ab5c5945368deec
Contents?: true
Size: 1.3 KB
Versions: 15
Compression:
Stored size: 1.3 KB
Contents
require 'olivander/resources/model_registry' module Olivander module Resources module ModelRegistrar extend ActiveSupport::Concern included do def this_is_included_method puts 'hi' end end class_methods do def register_model(model = self, context: :default, using: self, &block) Rails.logger.debug "###################" Rails.logger.debug "registering model #{model.name} in context #{context} using #{using&.name} at #{self.name}" using.register_model(model, context: context, &block) && return unless using == self ::Olivander::Resources::ModelRegistry.global_registry.register(model, &block) Rails.logger.debug "###################\n" end end end class TestRegistrant end class TestRegistrar include ModelRegistrar end class TestRegistrar2 include ModelRegistrar # register_model do # puts 'hello' # field_layout :show do :all end # end # register_model Olivander::Resources::TestRegistrant, context: :foo do # puts 'this is the other thing' # field_layout do [[1, :id]] end # end # register_model context: :bar, using: TestRegistrar do # puts 'and lastly...' # end end end end
Version data entries
15 entries across 15 versions & 1 rubygems