Class: I18nAttributes::ModelGenerator
- Inherits:
-
Rails::Generators::NamedBase
- Object
- Rails::Generators::NamedBase
- I18nAttributes::ModelGenerator
- Includes:
- GeneratorHelpers
- Defined in:
- lib/generators/i18n_attributes/model/model_generator.rb
Constant Summary collapse
- SUPPORTED_ORMS =
%w(active_record active_model mongoid)
Instance Method Summary collapse
Methods included from GeneratorHelpers
Instance Method Details
#create_model_i18n_file ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/generators/i18n_attributes/model/model_generator.rb', line 11 def create_model_i18n_file orm = .orm.to_s say_error "#{orm} [not found]" unless SUPPORTED_ORMS.include? orm I18nAttributes::Configuration.locales.each do |locale| create_file "config/locales/model_#{ locale }/#{ file_name }.yml", generate_yaml_file_data(locale, singular_name, human_name, attributes_hash, orm) end end |