class Penman::Configuration
Attributes
after_generate[RW]
default_candidate_key[RW]
file_name_formatter[RW]
seed_path[RW]
seed_template_file[RW]
validate_records_before_seed_generation[RW]
Public Class Methods
new()
click to toggle source
# File lib/penman/configuration.rb, line 10 def initialize @seed_path = 'db/migrate' @default_candidate_key = :reference root = File.expand_path '../..', __FILE__ @seed_template_file = File.join(root, 'templates', 'default.rb.erb') @file_name_formatter = lambda do |model_name, seed_type| "#{model_name.underscore.pluralize}_#{seed_type}" end @after_generate = lambda do |version, name| return unless ActiveRecord::Base.connection.table_exists? 'schema_migrations' unless Object.const_defined?('SchemaMigration') Object.const_set('SchemaMigration', Class.new(ActiveRecord::Base)) end return unless SchemaMigration.column_names.include? 'version' SchemaMigration.find_or_create_by(version: version) end @validate_records_before_seed_generation = false end