From b36f123d09e947fa2e1d35ffb0e973b028673d92 Mon Sep 17 00:00:00 2001 From: Claudius Nicolae Date: Wed, 24 Sep 2014 01:15:27 +0300 Subject: Explicit route test class shows the class that the test must extend in order to have the assert_routing method available --- guides/source/testing.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'guides') diff --git a/guides/source/testing.md b/guides/source/testing.md index 29724ae011..f6baccb105 100644 --- a/guides/source/testing.md +++ b/guides/source/testing.md @@ -904,8 +904,10 @@ Testing Routes Like everything else in your Rails application, it is recommended that you test your routes. An example test for a route in the default `show` action of `Articles` controller above should look like: ```ruby -test "should route to article" do - assert_routing '/articles/1', {controller: "articles", action: "show", id: "1"} +class ArticleRoutesTest < ActionController::TestCase + test "should route to article" do + assert_routing '/articles/1', { controller: "articles", action: "show", id: "1" } + end end ``` -- cgit v1.2.3 From 11ab04b11170253e96515c3ada6f2566b092533a Mon Sep 17 00:00:00 2001 From: Terry Meacham Date: Tue, 23 Sep 2014 15:51:44 -0500 Subject: Added queue_name_delimiter attribute. - Added ActiveJob::Base#queue_name_delimiter to allow for developers using ActiveJob to change the delimiter from the default ('_') to whatever else they may be using (e.g., '.', '-', ...). - Updated source guide to include a blurb about the delimiter. --- guides/source/active_job_basics.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'guides') diff --git a/guides/source/active_job_basics.md b/guides/source/active_job_basics.md index 9c34418fab..0f63a1c7e7 100644 --- a/guides/source/active_job_basics.md +++ b/guides/source/active_job_basics.md @@ -149,6 +149,29 @@ end # environment ``` +The default queue name prefix delimiter is '_'. This can be changed by setting +`config.active_job.queue_name_delimiter` in `application.rb`: + +```ruby +# config/application.rb +module YourApp + class Application < Rails::Application + config.active_job.queue_name_prefix = Rails.env + config.active_job.queue_name_delimiter = '.' + end +end + +# app/jobs/guests_cleanup.rb +class GuestsCleanupJob < ActiveJob::Base + queue_as :low_priority + #.... +end + +# Now your job will run on queue production.low_priority on your +# production environment and on staging.low_priority on your staging +# environment +``` + If you want more control on what queue a job will be run you can pass a :queue option to #set: -- cgit v1.2.3 From 0cd6c0842d6e003c49b3ea549b9a7d4be182c02a Mon Sep 17 00:00:00 2001 From: Godfrey Chan Date: Tue, 28 Oct 2014 09:48:01 -0700 Subject: Mention only_path deprecation in release notes [ci skip] --- guides/source/4_2_release_notes.md | 3 +++ 1 file changed, 3 insertions(+) (limited to 'guides') diff --git a/guides/source/4_2_release_notes.md b/guides/source/4_2_release_notes.md index d903752cff..d9f49aac55 100644 --- a/guides/source/4_2_release_notes.md +++ b/guides/source/4_2_release_notes.md @@ -395,6 +395,9 @@ Please refer to the [Changelog][action-pack] for detailed changes. ### Deprecations +* Deprecated the `only_path` option on `*_path` helpers. + ([Commit](https://github.com/rails/rails/commit/aa1fadd48fb40dd9396a383696134a259aa59db9)) + * Deprecated `assert_tag`, `assert_no_tag`, `find_tag` and `find_all_tag` in favor of `assert_select`. ([Commit](https://github.com/rails/rails-dom-testing/commit/b12850bc5ff23ba4b599bf2770874dd4f11bf750)) -- cgit v1.2.3 From be318260a3983f6eabd4f81d42ae4116d5aa7a62 Mon Sep 17 00:00:00 2001 From: Robin Tweedie Date: Wed, 29 Oct 2014 13:10:01 +0000 Subject: better example for tokenizer lambda [ci skip] Splitting on whitespace makes more sense in the context of counting words in an essay. --- guides/source/active_record_validations.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guides') diff --git a/guides/source/active_record_validations.md b/guides/source/active_record_validations.md index 1c1b863fe9..6f45ca698d 100644 --- a/guides/source/active_record_validations.md +++ b/guides/source/active_record_validations.md @@ -427,7 +427,7 @@ class Essay < ActiveRecord::Base validates :content, length: { minimum: 300, maximum: 400, - tokenizer: lambda { |str| str.scan(/\w+/) }, + tokenizer: lambda { |str| str.split(/\s+/) }, too_short: "must have at least %{count} words", too_long: "must have at most %{count} words" } -- cgit v1.2.3 From 8185fc734a50867de5349875e4b6548ab217819e Mon Sep 17 00:00:00 2001 From: Hannah Briggs Date: Wed, 29 Oct 2014 11:45:18 -0700 Subject: [ci skip] Fixes typos in section 2.7 "Rails Html Sanitizer", adds content to section 2.8 "Rails DOM Testing" --- guides/source/upgrading_ruby_on_rails.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'guides') diff --git a/guides/source/upgrading_ruby_on_rails.md b/guides/source/upgrading_ruby_on_rails.md index 8a1d7af923..f07dcd04f7 100644 --- a/guides/source/upgrading_ruby_on_rails.md +++ b/guides/source/upgrading_ruby_on_rails.md @@ -177,7 +177,7 @@ after_bundle do end ``` -### Rails Html Sanitizer +### Rails HTML Sanitizer There's a new choice for sanitizing HTML fragments in your applications. The venerable html-scanner approach is now officially being deprecated in favor of @@ -200,15 +200,15 @@ Read the [gem's readme](https://github.com/rails/rails-html-sanitizer) for more The documentation for `PermitScrubber` and `TargetScrubber` explains how you can gain complete control over when and how elements should be stripped. -If your application needs to use the old behaviour, include `rails-deprecated_sanitizer` in your Gemfile: +If your application needs to use the old sanitizer implementation, include `rails-deprecated_sanitizer` in your Gemfile: ```ruby gem 'rails-deprecated_sanitizer' ``` ### Rails DOM Testing +The [`TagAssertions` module](http://api.rubyonrails.org/classes/ActionDispatch/Assertions/TagAssertions.html) (containing methods such as `assert_tag`), [has been deprecated](https://github.com/rails/rails/blob/6061472b8c310158a2a2e8e9a6b81a1aef6b60fe/actionpack/lib/action_dispatch/testing/assertions/dom.rb) in favor of the `assert_select` methods from the `SelectorAssertions` module, which has been extracted into the [rails-dom-testing gem](https://github.com/rails/rails-dom-testing). -TODO: Mention https://github.com/rails/rails/commit/4e97d7585a2f4788b9eed98c6cdaf4bb6f2cf5ce Upgrading from Rails 4.0 to Rails 4.1 ------------------------------------- -- cgit v1.2.3 From 79e5c0de6d87a7957889a0ff1fe9063337e627a2 Mon Sep 17 00:00:00 2001 From: Chris Moylan Date: Wed, 29 Oct 2014 16:36:16 -0500 Subject: correct GlobalID mixin name in the guides --- guides/source/active_job_basics.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guides') diff --git a/guides/source/active_job_basics.md b/guides/source/active_job_basics.md index 0f63a1c7e7..875919e237 100644 --- a/guides/source/active_job_basics.md +++ b/guides/source/active_job_basics.md @@ -286,7 +286,7 @@ class TrashableCleanupJob end ``` -This works with any class that mixes in `ActiveModel::GlobalIdentification`, which +This works with any class that mixes in `GlobalID::Identification`, which by default has been mixed into Active Model classes. -- cgit v1.2.3 From 568c057e80b5a5c33baca6b27ce6ebf356b42777 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Strza=C5=82kowski?= Date: Thu, 30 Oct 2014 16:55:39 +0100 Subject: Add :db_runtime to table [ci skip] It was missing from table, but is present in sample hash below --- guides/source/active_support_instrumentation.md | 1 + 1 file changed, 1 insertion(+) (limited to 'guides') diff --git a/guides/source/active_support_instrumentation.md b/guides/source/active_support_instrumentation.md index 7033947468..3d9c45a3de 100644 --- a/guides/source/active_support_instrumentation.md +++ b/guides/source/active_support_instrumentation.md @@ -136,6 +136,7 @@ Action Controller | `:method` | HTTP request verb | | `:path` | Request path | | `:view_runtime` | Amount spent in view in ms | +| `:db_runtime` | Amount spent executing database queries in ms | ```ruby { -- cgit v1.2.3 From d20f7b043a537b57ff4a7911f65de2fb7b7aea7d Mon Sep 17 00:00:00 2001 From: Zachary Scott Date: Thu, 30 Oct 2014 09:01:18 -0700 Subject: Add status code to AS::Instrumentation table, like #17441 [ci skip] --- guides/source/active_support_instrumentation.md | 1 + 1 file changed, 1 insertion(+) (limited to 'guides') diff --git a/guides/source/active_support_instrumentation.md b/guides/source/active_support_instrumentation.md index 3d9c45a3de..83f3645b31 100644 --- a/guides/source/active_support_instrumentation.md +++ b/guides/source/active_support_instrumentation.md @@ -135,6 +135,7 @@ Action Controller | `:format` | html/js/json/xml etc | | `:method` | HTTP request verb | | `:path` | Request path | +| `:status` | HTTP status code | | `:view_runtime` | Amount spent in view in ms | | `:db_runtime` | Amount spent executing database queries in ms | -- cgit v1.2.3 From a34db582049a5e802b6cde8a8bdf64c9a5734582 Mon Sep 17 00:00:00 2001 From: "yuuji.yaginuma" Date: Fri, 31 Oct 2014 09:39:40 +0900 Subject: [ci skip] fix incorrect key in Active Support Instrumentation guide --- guides/source/active_support_instrumentation.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'guides') diff --git a/guides/source/active_support_instrumentation.md b/guides/source/active_support_instrumentation.md index 83f3645b31..9dfacce560 100644 --- a/guides/source/active_support_instrumentation.md +++ b/guides/source/active_support_instrumentation.md @@ -225,11 +225,11 @@ Active Record ### sql.active_record -| Key | Value | -| ------------ | --------------------- | -| `:sql` | SQL statement | -| `:name` | Name of the operation | -| `:object_id` | `self.object_id` | +| Key | Value | +| ---------------- | --------------------- | +| `:sql` | SQL statement | +| `:name` | Name of the operation | +| `:connection_id` | `self.object_id` | INFO. The adapters will add their own data as well. -- cgit v1.2.3 From d38d8d579c78650b02e367df490226869aef954b Mon Sep 17 00:00:00 2001 From: Hannah Briggs Date: Fri, 31 Oct 2014 10:33:24 -0700 Subject: Add masked authenticity token section, details on finder options, misc typos [ci skip] --- guides/source/upgrading_ruby_on_rails.md | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'guides') diff --git a/guides/source/upgrading_ruby_on_rails.md b/guides/source/upgrading_ruby_on_rails.md index 8a1d7af923..c66fa4df27 100644 --- a/guides/source/upgrading_ruby_on_rails.md +++ b/guides/source/upgrading_ruby_on_rails.md @@ -177,7 +177,7 @@ after_bundle do end ``` -### Rails Html Sanitizer +### Rails HTML Sanitizer There's a new choice for sanitizing HTML fragments in your applications. The venerable html-scanner approach is now officially being deprecated in favor of @@ -210,6 +210,9 @@ gem 'rails-deprecated_sanitizer' TODO: Mention https://github.com/rails/rails/commit/4e97d7585a2f4788b9eed98c6cdaf4bb6f2cf5ce +### Masked Authenticity Tokens +In order to mitigate SSL attacks, `form_authenticity_token` is now masked so that it varies with each request. Thus, tokens are validated by unmasking and then decrypting. As a result, any strategies for verifying requests from non-rails forms that relied on a static session CSRF token have to take this into account. + Upgrading from Rails 4.0 to Rails 4.1 ------------------------------------- @@ -233,7 +236,7 @@ will now trigger CSRF protection. Switch to xhr :get, :index, format: :js ``` -to explicitly test an XmlHttpRequest. +to explicitly test an `XmlHttpRequest`. If you really mean to load JavaScript from remote `