var_model_generator.rb
406 Bytes
require 'rails/generators'
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_status_to_#{name.pluralize.underscore}.rb"
end
end