Sha256: 91d5cd642c29d491426825b89a2fe7c2b53418ca33e81dca5675f0f8060d201c
Contents?: true
Size: 917 Bytes
Versions: 5
Compression:
Stored size: 917 Bytes
Contents
module ForestLiana class ControllerFactory def self.define_controller(active_record_class, service) class_name = active_record_class.table_name.classify module_name = class_name.deconstantize name = module_name if module_name name += class_name.demodulize ForestLiana.const_set("#{name}Controller", service) end def self.get_controller_name(active_record_class) class_name = active_record_class.table_name.classify module_name = class_name.deconstantize name = module_name if module_name name += class_name.demodulize "ForestLiana::#{name}Controller" end def controller_for(active_record_class) controller = Class.new(ResourcesController) { } ForestLiana::ControllerFactory.define_controller(active_record_class, controller) controller end end end
Version data entries
5 entries across 5 versions & 1 rubygems