class ActiveRecord::Generators::RemexifyGenerator
Public Class Methods
next_migration_number(path)
click to toggle source
# File lib/generators/active_record/remexify_generator.rb, line 13 def self.next_migration_number(path) @secondth += 1 (Time.now.utc. + @secondth).strftime("%Y%m%d%H%M%S") end
Public Instance Methods
copy_migration()
click to toggle source
copy the migration
# File lib/generators/active_record/remexify_generator.rb, line 19 def copy_migration migration_template "create_remexify_lognotes.rb", "db/migrate/create_remexify_lognotes.rb" migration_template "create_remexify_logowners.rb", "db/migrate/create_remexify_logowners.rb" end
generate_model()
click to toggle source
generate appropriate model
# File lib/generators/active_record/remexify_generator.rb, line 25 def generate_model # don't just call invoke without Rails::Generators because Thor task only run once. Rails::Generators.invoke "active_record:model", [name, "--no-migration"] Rails::Generators.invoke "active_record:model", ["#{name}Owners", "--no-migration"] # invoke "active_record:model", ["Remexify::Logs", "md5:string"], {migration: true, timestamps: true} end
make_initializer()
click to toggle source
# File lib/generators/active_record/remexify_generator.rb, line 32 def make_initializer template "initialize_remexify.rb", "config/initializers/00_remexify.rb" end