Sha256: f209bab8203b07e6ec48bdcdf8b3cdceb8bc2059878b14063737235559a75d60
Contents?: true
Size: 1.16 KB
Versions: 1
Compression:
Stored size: 1.16 KB
Contents
#encoding: utf-8 class I18nAttributes::ReviseModelGenerator < Rails::Generators::Base source_root File.expand_path('../templates', __FILE__) class_option :orm, :required => false, :default => "active_record" include ::VkillGemsMethods::Rails::Generators::Base ::ActiveRecord::Base.send :include, ::VkillGemsMethods::ActiveRecord::Base include ::I18nAttributes::GeneratorHelpers SUPPORTED_ORMS = %w(active_model active_record mongoid) def create_model_i18n_file say_error "#{orm} [not found]" unless SUPPORTED_ORMS.include? options.orm.to_s ::ActiveRecord::Base.models do |model, columns| ::I18nAttributes::Configuration.locales.each do |locale| create_file "config/locales/model_#{ locale }/#{ model.name.underscore }.yml", generate_yaml_file_data( :locale => locale, :singular_name => model.model_name.underscore, :human_name => model.model_name, :attributes => columns, :model_i18n_scope => model.i18n_scope ){|word| say_info "translated attribute/model_name #{word}"}.yaml_file_data end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
i18n_attributes-0.1.6 | lib/generators/i18n_attributes/revise_model/revise_model_generator.rb |