lib/generators/translateable/migration_generator.rb in translateable-0.1.8 vs lib/generators/translateable/migration_generator.rb in translateable-0.2.0

- old
+ new

@@ -8,33 +8,18 @@ source_root File.expand_path('templates', __dir__) argument :field_name, type: :string argument :locale, type: :string, default: I18n.default_locale - # rubocop: disable Metrics/AbcSize def create_migration_file raise ArgumentError, "given locale #{locale} is not available, check I18n.available_locales" unless I18n.available_locales.include?(locale.to_sym) - migration_template('migration.rb.erb', "db/migrate/migrate_translateable_#{name}_#{field_name}.rb", - migration_version: migration_version, - table_name: name, - field_name: field_name, - field_type: name.classify.constantize.columns_hash[field_name].type, - locale: locale) + migration_template('migration.rb.erb', "db/migrate/migrate_translateable_#{table_name}_#{field_name}.rb", migration_version: migration_version) end - # rubocop: enable Metrics/AbcSize private - def rails5? - Rails.version.start_with?('5') - end - def migration_version - if rails5? - "[#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}]" - else - '' - end + "[#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}]" end end end end