Sha256: 7c2b40f64101f8a8f8f27ec504f6f3703ed6a76b5eae2c6f89d06446b9054d68
Contents?: true
Size: 943 Bytes
Versions: 2
Compression:
Stored size: 943 Bytes
Contents
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_record) def create_model_i18n_file orm = options.orm.to_s say_error "#{orm} [not found]" unless SUPPORTED_ORMS.include? orm ::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, model.model_name.underscore, model.model_name, columns, orm, model.i18n_scope) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
i18n_attributes-0.1.4 | lib/generators/i18n_attributes/revise_model/revise_model_generator.rb |
i18n_attributes-0.1.3 | lib/generators/i18n_attributes/revise_model/revise_model_generator.rb |