var_model_generator.rb 436 Bytes
require 'rails/generators'
# Generator for models
class VarModelGenerator < Rails::Generators::NamedBase
  source_root File.expand_path('../templates', __FILE__)
  desc 'This generator generates layout file with navigation.'

  def generate_model
    d = Time.now.strftime('%Y%m%d%H%M%S')
    @model_name = name
    template 'var_model.rb',
             "db/migrate/#{d}_add_var_attributes_to_#{name.pluralize.underscore}.rb"
  end
end