-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use explicit default for configuration
- Loading branch information
Showing
3 changed files
with
135 additions
and
176 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
229 changes: 113 additions & 116 deletions
229
lib/rails/generators/mobility/templates/initializer.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,129 +1,126 @@ | ||
Mobility.configure do | ||
# PLUGINS | ||
plugins do | ||
# Backend | ||
# | ||
# Sets the default backend to use in models. This can be overridden in models | ||
# by passing +backend: ...+ to +translates+. | ||
# | ||
# To default to a different backend globally, replace +:key_value+ by another | ||
# backend name. | ||
# | ||
backend :key_value | ||
Mobility.configure do |config| | ||
# Backend | ||
# | ||
# Sets the default backend to use in models. This can be overridden in models | ||
# by passing +backend: ...+ to +translates+. | ||
# | ||
# To default to a different backend globally, replace +:key_value+ by another | ||
# backend name. | ||
# | ||
config.plugin(:backend, :key_value) | ||
|
||
# ActiveRecord | ||
# | ||
# Defines ActiveRecord as ORM, and enables ActiveRecord-specific plugins. | ||
active_record | ||
# ActiveRecord | ||
# | ||
# Defines ActiveRecord as ORM, and enables ActiveRecord-specific plugins. | ||
config.plugin(:active_record) | ||
|
||
# Accessors | ||
# | ||
# Define reader and writer methods for translated attributes. Remove either | ||
# to disable globally, or pass +reader: false+ or +writer: false+ to | ||
# +translates+ in any translated model. | ||
# | ||
reader | ||
writer | ||
# Accessors | ||
# | ||
# Define reader and writer methods for translated attributes. Remove either | ||
# to disable globally, or pass +reader: false+ or +writer: false+ to | ||
# +translates+ in any translated model. | ||
# | ||
config.plugin(:reader) | ||
config.plugin(:writer) | ||
|
||
# Backend Reader | ||
# | ||
# Defines reader to access the backend for any attribute, of the form | ||
# +<attribute>_backend+. | ||
# | ||
backend_reader | ||
# | ||
# Or pass an interpolation string to define a different pattern: | ||
# backend_reader "%s_translations" | ||
# Backend Reader | ||
# | ||
# Defines reader to access the backend for any attribute, of the form | ||
# +<attribute>_backend+. | ||
# | ||
backend_reader | ||
# | ||
# Or pass an interpolation string to define a different pattern: | ||
# backend_reader "%s_translations" | ||
|
||
# Query | ||
# | ||
# Defines a scope on the model class which allows querying on | ||
# translated attributes. The default scope is named +i18n+, pass a different | ||
# name as default to change the global default, or to +translates+ in any | ||
# model to change it for that model alone. | ||
# | ||
query | ||
# Query | ||
# | ||
# Defines a scope on the model class which allows querying on | ||
# translated attributes. The default scope is named +i18n+, pass a different | ||
# name as default to change the global default, or to +translates+ in any | ||
# model to change it for that model alone. | ||
# | ||
query | ||
|
||
# Cache | ||
# | ||
# Comment out to disable caching reads and writes. | ||
# | ||
cache | ||
# Cache | ||
# | ||
# Comment out to disable caching reads and writes. | ||
# | ||
cache | ||
|
||
# Dirty | ||
# | ||
# Uncomment this line to include and enable globally: | ||
# dirty | ||
# | ||
# Or uncomment this line to include but disable by default, and only enable | ||
# per model by passing +dirty: true+ to +translates+. | ||
# dirty false | ||
|
||
# Column Fallback | ||
# | ||
# Uncomment line below to fallback to original column. You can pass | ||
# +column_fallback: true+ to +translates+ to return original column on | ||
# default locale, or pass +column_fallback: [:en, :de]+ to +translates+ | ||
# to return original column for those locales or pass | ||
# +column_fallback: ->(locale) { ... }+ to +translates to evaluate which | ||
# locales to return original column for. | ||
# column_fallback | ||
# | ||
# Or uncomment this line to enable column fallback with a global default. | ||
# column_fallback true | ||
# Dirty | ||
# | ||
# Uncomment this line to include and enable globally: | ||
# dirty | ||
# | ||
# Or uncomment this line to include but disable by default, and only enable | ||
# per model by passing +dirty: true+ to +translates+. | ||
# dirty false | ||
|
||
# Fallbacks | ||
# | ||
# Uncomment line below to enable fallbacks, using +I18n.fallbacks+. | ||
# fallbacks | ||
# | ||
# Or uncomment this line to enable fallbacks with a global default. | ||
# fallbacks(pt: :en) | ||
# Column Fallback | ||
# | ||
# Uncomment line below to fallback to original column. You can pass | ||
# +column_fallback: true+ to +translates+ to return original column on | ||
# default locale, or pass +column_fallback: [:en, :de]+ to +translates+ | ||
# to return original column for those locales or pass | ||
# +column_fallback: ->(locale) { ... }+ to +translates to evaluate which | ||
# locales to return original column for. | ||
# column_fallback | ||
# | ||
# Or uncomment this line to enable column fallback with a global default. | ||
# column_fallback true | ||
|
||
# Presence | ||
# | ||
# Converts blank strings to nil on reads and writes. Comment out to | ||
# disable. | ||
# | ||
presence | ||
# Fallbacks | ||
# | ||
# Uncomment line below to enable fallbacks, using +I18n.fallbacks+. | ||
# fallbacks | ||
# | ||
# Or uncomment this line to enable fallbacks with a global default. | ||
# fallbacks(pt: :en) | ||
|
||
# Default | ||
# | ||
# Set a default translation per attributes. When enabled, passing +default: | ||
# 'foo'+ sets a default translation string to show in case no translation is | ||
# present. Can also be passed a proc. | ||
# | ||
# default 'foo' | ||
# Presence | ||
# | ||
# Converts blank strings to nil on reads and writes. Comment out to | ||
# disable. | ||
# | ||
presence | ||
|
||
# Fallthrough Accessors | ||
# | ||
# Uses method_missing to define locale-specific accessor methods like | ||
# +title_en+, +title_en=+, +title_fr+, +title_fr=+ for each translated | ||
# attribute. If you know what set of locales you want to support, it's | ||
# generally better to use Locale Accessors (or both together) since | ||
# +method_missing+ is very slow. (You can use both fallthrough and locale | ||
# accessor plugins together without conflict.) | ||
# | ||
# fallthrough_accessors | ||
# Default | ||
# | ||
# Set a default translation per attributes. When enabled, passing +default: | ||
# 'foo'+ sets a default translation string to show in case no translation is | ||
# present. Can also be passed a proc. | ||
# | ||
# default 'foo' | ||
|
||
# Locale Accessors | ||
# | ||
# Uses +def+ to define accessor methods for a set of locales. By default uses | ||
# +I18n.available_locales+, but you can pass the set of locales with | ||
# +translates+ and/or set a global default here. | ||
# | ||
# locale_accessors | ||
# | ||
# Or define specific defaults by uncommenting line below | ||
# locale_accessors [:en, :ja] | ||
# Fallthrough Accessors | ||
# | ||
# Uses method_missing to define locale-specific accessor methods like | ||
# +title_en+, +title_en=+, +title_fr+, +title_fr=+ for each translated | ||
# attribute. If you know what set of locales you want to support, it's | ||
# generally better to use Locale Accessors (or both together) since | ||
# +method_missing+ is very slow. (You can use both fallthrough and locale | ||
# accessor plugins together without conflict.) | ||
# | ||
# config.plugin(:fallthrough_accessors) | ||
|
||
# Attribute Methods | ||
# | ||
# Adds translated attributes to +attributes+ hash, and defines methods | ||
# +translated_attributes+ and +untranslated_attributes+ which return hashes | ||
# with translated and untranslated attributes, respectively. Be aware that | ||
# this plugin can create conflicts with other gems. | ||
# | ||
# attribute_methods | ||
end | ||
# Locale Accessors | ||
# | ||
# Uses +def+ to define accessor methods for a set of locales. By default uses | ||
# +I18n.available_locales+, but you can pass the set of locales with | ||
# +translates+ and/or set a global default here. | ||
# | ||
# config.plugin(:locale_accessors) | ||
# | ||
# Or define specific defaults by uncommenting line below | ||
# config.plugin(:locale_accessors, [:en, :ja]) | ||
|
||
# Attribute Methods | ||
# | ||
# Adds translated attributes to +attributes+ hash, and defines methods | ||
# +translated_attributes+ and +untranslated_attributes+ which return hashes | ||
# with translated and untranslated attributes, respectively. Be aware that | ||
# this plugin can create conflicts with other gems. | ||
# | ||
# config.plugin(:attribute_methods) | ||
end |
Oops, something went wrong.