Sha256: 4540e294578e648f04ad2c0cab9000987478c1c8d8d058c8385710012855ebfd
Contents?: true
Size: 852 Bytes
Versions: 1
Compression:
Stored size: 852 Bytes
Contents
require "active_generator/base" require "generators/locale/base" module Locale class ModelGenerator < Rails::Generators::NamedBase include ActiveGenerator::Base include Locale::Base source_root File.expand_path('../templates', __FILE__) argument :language, type: :string, required: false, default: "en", desc: "The locale alpha code" def copy_model_file assert_valid_language! template("model.yml", "config/locales/#{language}/models/#{file_name}.yml") end end end if ActiveGenerator.configuration.autoload_model_generator_locale begin require "rails/generators/rails/model/model_generator" Rails::Generators::ModelGenerator.class_eval do def generate_model_locale_file invoke("locale:model", [name]) end end rescue LoadError => e # Skip over missing files end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
active_generator-2.0.11 | lib/generators/locale/model/model_generator.rb |