Sha256: 58d0520e5ff3b41102f102ac554f9e422f5fb348a0a66e280a511f014be8d94a
Contents?: true
Size: 347 Bytes
Versions: 14
Compression:
Stored size: 347 Bytes
Contents
module ModelMacros # Create a new model class def spawn_model(klass_name, parent_klass = ActiveRecord::Base, &block) Object.instance_eval { remove_const klass_name } if Object.const_defined?(klass_name) Object.const_set(klass_name, Class.new(parent_klass)) Object.const_get(klass_name).class_eval(&block) if block_given? end end
Version data entries
14 entries across 14 versions & 1 rubygems