Module: Transit::Admin
- Defined in:
- lib/transit/admin.rb
Overview
Manages configuration options for models. When a model is managed via the admin, register it by Transit::Admin.register and passing a configuration block.
Defined Under Namespace
Classes: DSL
Class Method Summary collapse
Class Method Details
.register(klass, &block) ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/transit/admin.rb', line 14 def self.register(klass, &block) klass = klass.to_s.classify.constantize unless klass.respond_to?(:admin_options) klass.send(:class_attribute, :admin_options, instance_writer: false) end dsl = klass. ||= DSL.new block.call(dsl) klass. = dsl end |