diff options
Diffstat (limited to 'guides')
-rw-r--r-- | guides/Rakefile | 11 | ||||
-rw-r--r-- | guides/assets/images/getting_started/template_is_missing_articles_new.png | bin | 472167 -> 26796 bytes | |||
-rw-r--r-- | guides/bug_report_templates/active_record_gem.rb | 2 | ||||
-rw-r--r-- | guides/bug_report_templates/active_record_migrations_gem.rb | 2 | ||||
-rw-r--r-- | guides/source/active_support_core_extensions.md | 2 | ||||
-rw-r--r-- | guides/source/api_app.md | 2 | ||||
-rw-r--r-- | guides/source/getting_started.md | 23 | ||||
-rw-r--r-- | guides/source/routing.md | 2 |
8 files changed, 27 insertions, 17 deletions
diff --git a/guides/Rakefile b/guides/Rakefile index 4116e6f9cc..b7425f6de4 100644 --- a/guides/Rakefile +++ b/guides/Rakefile @@ -88,4 +88,15 @@ HELP end end +task :test do + templates = Dir.glob("bug_report_templates/*.rb") + counter = templates.count do |file| + puts "--- Running #{file}" + Bundler.clean_system(Gem.ruby, "-w", file) || + puts("+++ 💥 FAILED (exit #{$?.exitstatus})") + end + puts "+++ #{counter} / #{templates.size} templates executed successfully" + exit 1 if counter < templates.size +end + task default: "guides:help" diff --git a/guides/assets/images/getting_started/template_is_missing_articles_new.png b/guides/assets/images/getting_started/template_is_missing_articles_new.png Binary files differindex a1603f5d28..830b19bd9d 100644 --- a/guides/assets/images/getting_started/template_is_missing_articles_new.png +++ b/guides/assets/images/getting_started/template_is_missing_articles_new.png diff --git a/guides/bug_report_templates/active_record_gem.rb b/guides/bug_report_templates/active_record_gem.rb index d88304a219..74b329115d 100644 --- a/guides/bug_report_templates/active_record_gem.rb +++ b/guides/bug_report_templates/active_record_gem.rb @@ -9,7 +9,7 @@ gemfile(true) do # Activate the gem you are reporting the issue against. gem "activerecord", "5.2.0" - gem "sqlite3" + gem "sqlite3", "~> 1.3.6" end require "active_record" diff --git a/guides/bug_report_templates/active_record_migrations_gem.rb b/guides/bug_report_templates/active_record_migrations_gem.rb index 5dfd49fb38..8d71863034 100644 --- a/guides/bug_report_templates/active_record_migrations_gem.rb +++ b/guides/bug_report_templates/active_record_migrations_gem.rb @@ -9,7 +9,7 @@ gemfile(true) do # Activate the gem you are reporting the issue against. gem "activerecord", "5.2.0" - gem "sqlite3" + gem "sqlite3", "~> 1.3.6" end require "active_record" diff --git a/guides/source/active_support_core_extensions.md b/guides/source/active_support_core_extensions.md index 3db46bc42e..903f39994f 100644 --- a/guides/source/active_support_core_extensions.md +++ b/guides/source/active_support_core_extensions.md @@ -1201,6 +1201,8 @@ The `inquiry` method converts a string into a `StringInquirer` object making equ "active".inquiry.inactive? # => false ``` +NOTE: Defined in `active_support/core_ext/string/inquiry.rb`. + ### `starts_with?` and `ends_with?` Active Support defines 3rd person aliases of `String#start_with?` and `String#end_with?`: diff --git a/guides/source/api_app.md b/guides/source/api_app.md index 85367c50e7..870f5f7b87 100644 --- a/guides/source/api_app.md +++ b/guides/source/api_app.md @@ -374,7 +374,7 @@ controller modules by default: - `ActionController::Renderers::All`: Support for `render :json` and friends. - `ActionController::ConditionalGet`: Support for `stale?`. - `ActionController::BasicImplicitRender`: Makes sure to return an empty response, if there isn't an explicit one. -- `ActionController::StrongParameters`: Support for parameters white-listing in combination with Active Model mass assignment. +- `ActionController::StrongParameters`: Support for parameters filtering in combination with Active Model mass assignment. - `ActionController::DataStreaming`: Support for `send_file` and `send_data`. - `AbstractController::Callbacks`: Support for `before_action` and similar helpers. diff --git a/guides/source/getting_started.md b/guides/source/getting_started.md index 264c94326e..be59cd0cfa 100644 --- a/guides/source/getting_started.md +++ b/guides/source/getting_started.md @@ -461,22 +461,19 @@ available, Rails will raise an exception. Let's look at the full error message again: ->ArticlesController#new is missing a template for this request format and variant. request.formats: ["text/html"] request.variant: [] NOTE! For XHR/Ajax or API requests, this action would normally respond with 204 No Content: an empty white screen. Since you're loading it in a web browser, we assume that you expected to actually render a template, not… nothing, so we're showing an error to be extra-clear. If you expect 204 No Content, carry on. That's what you'll get from an XHR or API request. Give it a shot. +>ArticlesController#new is missing a template for request formats: text/html -That's quite a lot of text! Let's quickly go through and understand what each -part of it means. +>NOTE! +>Unless told otherwise, Rails expects an action to render a template with the same name, contained in a folder named after its controller. If this controller is an API responding with 204 (No Content), which does not require a template, then this error will occur when trying to access it via browser, since we expect an HTML template to be rendered for such requests. If that's the case, carry on. -The first part identifies which template is missing. In this case, it's the +The message identifies which template is missing. In this case, it's the `articles/new` template. Rails will first look for this template. If not found, -then it will attempt to load a template called `application/new`. It looks for -one here because the `ArticlesController` inherits from `ApplicationController`. - -The next part of the message contains `request.formats` which specifies -the format of template to be served in response. It is set to `text/html` as we -requested this page via browser, so Rails is looking for an HTML template. -`request.variant` specifies what kind of physical devices would be served by -the response and helps Rails determine which template to use in the response. -It is empty because no information has been provided. +then it will attempt to load a template called `application/new`, because the +`ArticlesController` inherits from `ApplicationController`. + +Next the message contains `request.formats` which specifies the format of +template to be served in response. It is set to `text/html` as we requested +this page via browser, so Rails is looking for an HTML template. The simplest template that would work in this case would be one located at `app/views/articles/new.html.erb`. The extension of this file name is important: diff --git a/guides/source/routing.md b/guides/source/routing.md index a33ac6a589..92d5b45e7d 100644 --- a/guides/source/routing.md +++ b/guides/source/routing.md @@ -260,7 +260,7 @@ In each of these cases, the named routes remain the same as if you did not use ` | PATCH/PUT | /admin/articles/:id | articles#update | article_path(:id) | | DELETE | /admin/articles/:id | articles#destroy | article_path(:id) | -TIP: _If you need to use a different controller namespace inside a `namespace` block you can specify an absolute controller path, e.g: `get '/foo' => '/foo#index'`._ +TIP: _If you need to use a different controller namespace inside a `namespace` block you can specify an absolute controller path, e.g: `get '/foo', to: '/foo#index'`._ ### Nested Resources |