@@ -424,13 +424,23 @@ encrypted cookies salt value. Defaults to `'signed encrypted cookie'`.
end
```
*`config.action_view.default_form_builder` tells Rails which form builder to use by default. The default is `ActionView::Helpers::FormBuilder`. If you want your form builder class to be loaded after initialization (so it's reloaded on each request in development), you can pass it as a `String`
*`config.action_view.default_form_builder` tells Rails which form builder to
use by default. The default is `ActionView::Helpers::FormBuilder`. If you
want your form builder class to be loaded after initialization (so it's
reloaded on each request in development), you can pass it as a `String`.
*`config.action_view.logger` accepts a logger conforming to the interface of Log4r or the default Ruby Logger class, which is then used to log information from Action View. Set to `nil` to disable logging.
*`config.action_view.erb_trim_mode` gives the trim mode to be used by ERB. It defaults to `'-'`, which turns on trimming of tail spaces and newline when using `<%= -%>` or `<%= =%>`. See the [Erubis documentation](http://www.kuwata-lab.com/erubis/users-guide.06.html#topics-trimspaces) for more information.
*`config.action_view.embed_authenticity_token_in_remote_forms` allows you to set the default behavior for `authenticity_token` in forms with `:remote => true`. By default it's set to false, which means that remote forms will not include `authenticity_token`, which is helpful when you're fragment-caching the form. Remote forms get the authenticity from the `meta` tag, so embedding is unnecessary unless you support browsers without JavaScript. In such case you can either pass `:authenticity_token => true` as a form option or set this config setting to `true`
*`config.action_view.embed_authenticity_token_in_remote_forms` allows you to
set the default behavior for `authenticity_token` in forms with `remote:
true`. By default it's set to false, which means that remote forms will not
include `authenticity_token`, which is helpful when you're fragment-caching
the form. Remote forms get the authenticity from the `meta` tag, so embedding
is unnecessary unless you support browsers without JavaScript. In such case
you can either pass `authenticity_token: true` as a form option or set this
config setting to `true`.
*`config.action_view.prefix_partial_path_with_controller_namespace` determines whether or not partials are looked up from a subdirectory in templates rendered from namespaced controllers. For example, consider a controller named `Admin::ArticlesController` which renders this template:
...
...
@@ -440,7 +450,8 @@ encrypted cookies salt value. Defaults to `'signed encrypted cookie'`.
The default setting is `true`, which uses the partial at `/admin/articles/_article.erb`. Setting the value to `false` would render `/articles/_article.erb`, which is the same behavior as rendering from a non-namespaced controller such as `ArticlesController`.
*`config.action_view.raise_on_missing_translations` determines whether an error should be raised for missing translations
*`config.action_view.raise_on_missing_translations` determines whether an
error should be raised for missing translations.
### Configuring Action Mailer
...
...
@@ -555,7 +566,7 @@ There are a few configuration options available in Active Support:
*`config.active_job.queue_name_prefix` allows you to set an optional, non-blank, queue name prefix for all jobs. By default it is blank and not used.
The following configuration would queue the given job on the `production_high_priority` queue when run in production:
```ruby
config.active_job.queue_name_prefix = Rails.env
```
...
...
@@ -1012,7 +1023,8 @@ Below is a comprehensive list of all the initializers found in Rails in the orde
*`active_record.set_dispatch_hooks` Resets all reloadable connections to the database if `config.cache_classes` is set to `false`.
*`active_job.logger` Sets `ActiveJob::Base.logger` - if it's not already set - to `Rails.logger`
*`active_job.logger` Sets `ActiveJob::Base.logger` - if it's not already set -
to `Rails.logger`.
*`active_job.set_configs` Sets up Active Job by using the settings in `config.active_job` by `send`'ing the method names as setters to `ActiveJob::Base` and passing the values through.
@@ -374,7 +374,8 @@ A CHANGELOG entry should summarize what was changed and should end with the auth
*Your Name*
```
Your name can be added directly after the last word if you don't provide any code examples or don't need multiple paragraphs. Otherwise, it's best to make as a new paragraph.
Your name can be added directly after the last word if there are no code
examples or multiple paragraphs. Otherwise, it's best to make a new paragraph.
### Updating the Gemfile.lock
...
...
@@ -406,13 +407,13 @@ Good commit message should be formatted according to the following example:
Short summary (ideally 50 characters or less)
More detailed description, if necessary. It should be wrapped to 72
characters. Try to be as descriptive as you can, even if you think that
the commit content is obvious, it may not be obvious to others. You
should add such description also if it's already present in bug tracker,
it should not be necessary to visit a webpage to check the history.
characters. Try to be as descriptive as you can; even if you think that the
commit content is obvious, it may not be obvious to others. Add any description
that is already present in relevant issues - it should not be necessary to visit
a webpage to check the history.
Description can have multiple paragraphs and you can use code examples
inside, just indent it with 4 spaces:
The description section can have multiple paragraphs. Code examples can be
embedded by indenting them with 4 spaces:
class ArticlesController
def index
...
...
@@ -428,7 +429,8 @@ You can also add bullet points:
long to fit in 72 characters
```
TIP. Please squash your commits into a single commit when appropriate. This simplifies future cherry picks, and also keeps the git log clean.
TIP. Please squash your commits into a single commit when appropriate. This
simplifies future cherry picks and also keeps the git log clean.
@@ -129,9 +129,14 @@ TIP: By default, each log is created under `Rails.root/log/` and the log file is
### Log Levels
When something is logged it's printed into the corresponding log if the log level of the message is equal or higher than the configured log level. If you want to know the current log level you can call the `Rails.logger.level` method.
The available log levels are: `:debug`, `:info`, `:warn`, `:error`, `:fatal`, and `:unknown`, corresponding to the log level numbers from 0 up to 5 respectively. To change the default log level, use
When something is logged, it's printed into the corresponding log if the log
level of the message is equal or higher than the configured log level. If you
want to know the current log level, you can call the `Rails.logger.level`
method.
The available log levels are: `:debug`, `:info`, `:warn`, `:error`, `:fatal`,
and `:unknown`, corresponding to the log level numbers from 0 up to 5,
respectively. To change the default log level, use
```ruby
config.log_level=:warn# In any environment initializer, or
@@ -489,7 +489,9 @@ NOTE: The default locale loading mechanism in Rails does not load locale files i
Overview of the I18n API Features
---------------------------------
You should have good understanding of using the i18n library now, knowing all necessary aspects of internationalizing a basic Rails application. In the following chapters, we'll cover it's features in more depth.
You should have a good understanding of using the i18n library now and know how
to internationalize a basic Rails application. In the following chapters, we'll
cover its features in more depth.
These chapters will show examples using both the `I18n.translate` method as well as the [`translate` view helper method](http://api.rubyonrails.org/classes/ActionView/Helpers/TranslationHelper.html#method-i-translate)(noting the additional feature provide by the view helper method).
@@ -1073,9 +1073,14 @@ One way to use partials is to treat them as the equivalent of subroutines: as a
<%=render"shared/footer"%>
```
Here, the `_ad_banner.html.erb` and `_footer.html.erb` partials could contain content that is shared among many pages in your application. You don't need to see the details of these sections when you're concentrating on a particular page.
As you already could see from the previous sections of this guide, `yield` is a very powerful tool for cleaning up your layouts. Keep in mind that it's pure ruby, so you can use it almost everywhere. For example, we can use it to DRY form layout definition for several similar resources:
Here, the `_ad_banner.html.erb` and `_footer.html.erb` partials could contain
content that is shared by many pages in your application. You don't need to see
the details of these sections when you're concentrating on a particular page.
As seen in the previous sections of this guide, `yield` is a very powerful tool
for cleaning up your layouts. Keep in mind that it's pure Ruby, so you can use
it almost everywhere. For example, we can use it to DRY up form layout