lib/rails/generators/mobility/translations_generator.rb in mobility-0.5.1 vs lib/rails/generators/mobility/translations_generator.rb in mobility-0.6.0
- old
+ new
@@ -27,19 +27,20 @@
skipped.
Other backends are not supported, for obvious reasons:
* the +key_value+ backend does not need any model-specific migrations, simply
run the install generator.
-* +jsonb+, +hstore+ and +serialized+ backends simply require a single column on
- a model table, which can be added with the normal Rails migration generator.
+* +json+, +jsonb+, +hstore+, +serialized+, and +container+ backends simply
+ require a single column on a model table, which can be added with the normal
+ Rails migration generator.
=end
class TranslationsGenerator < ::Rails::Generators::NamedBase
- SUPPORTED_BACKENDS = %w[column table]
- BACKEND_OPTIONS = { type: :string, desc: "Backend to use for translations (defaults to Mobility.default_backend)" }
+ SUPPORTED_BACKENDS = %w[column table].freeze
+ BACKEND_OPTIONS = { type: :string, desc: "Backend to use for translations (defaults to Mobility.default_backend)" }.freeze
argument :attributes, type: :array, default: [], banner: "field[:type][:index] field[:type][:index]"
- class_option(:backend, BACKEND_OPTIONS)
+ class_option(:backend, BACKEND_OPTIONS.dup)
invoke_from_option :backend
def self.class_options(options = nil)
super
@class_options[:backend] = Thor::Option.new(:backend, BACKEND_OPTIONS.merge(default: Mobility.default_backend.to_s.freeze))