Sha256: 084a0dade9e50a5acff07687d02ad20b859b90fe54ea37bd24b929d7e258c9b9

Contents?: true

Size: 745 Bytes

Versions: 50

Compression:

Stored size: 745 Bytes

Contents

require 'rails/generators'
require 'rails/generators/migration'
require 'rails/generators/active_record'

module Kuhsaft
  module Translations
    class Add < Rails::Generators::Base
      include Rails::Generators::Migration

      source_root(File.join(Kuhsaft::Engine.root, '/lib/templates/kuhsaft/translations'))
      argument :locale, :type => :string

      def self.next_migration_number(dirname)
        ActiveRecord::Generators::Base.next_migration_number(dirname)
      end

      def get_locale
        locale.downcase.underscore
      end
      def create_locale_migration_file
        migration_template('add_translation.html.erb', Rails.root.join('db', 'migrate', "add_#{get_locale}_translation.rb"))
      end

    end
  end
end

Version data entries

50 entries across 50 versions & 1 rubygems

Version Path
kuhsaft-2.2.6 lib/generators/kuhsaft/translations/add_generator.rb
kuhsaft-2.2.5 lib/generators/kuhsaft/translations/add_generator.rb
kuhsaft-2.2.4 lib/generators/kuhsaft/translations/add_generator.rb
kuhsaft-2.2.3 lib/generators/kuhsaft/translations/add_generator.rb
kuhsaft-2.2.2 lib/generators/kuhsaft/translations/add_generator.rb
kuhsaft-2.2.1 lib/generators/kuhsaft/translations/add_generator.rb
kuhsaft-2.2.0 lib/generators/kuhsaft/translations/add_generator.rb
kuhsaft-2.1.2 lib/generators/kuhsaft/translations/add_generator.rb
kuhsaft-2.1.1 lib/generators/kuhsaft/translations/add_generator.rb
kuhsaft-2.1.0 lib/generators/kuhsaft/translations/add_generator.rb
kuhsaft-1.8.6 lib/generators/kuhsaft/translations/add_generator.rb
kuhsaft-1.8.5 lib/generators/kuhsaft/translations/add_generator.rb
kuhsaft-2.0.3 lib/generators/kuhsaft/translations/add_generator.rb
kuhsaft-2.0.2 lib/generators/kuhsaft/translations/add_generator.rb
kuhsaft-1.8.4 lib/generators/kuhsaft/translations/add_generator.rb
kuhsaft-1.8.1 lib/generators/kuhsaft/translations/add_generator.rb
kuhsaft-2.0.1 lib/generators/kuhsaft/translations/add_generator.rb
kuhsaft-2.0.0 lib/generators/kuhsaft/translations/add_generator.rb
kuhsaft-1.8.0 lib/generators/kuhsaft/translations/add_generator.rb
kuhsaft-1.7.1 lib/generators/kuhsaft/translations/add_generator.rb