diff --git a/_import-this-week-in-rails.rb b/_import-this-week-in-rails.rb index bbc37cf6..b11867b6 100755 --- a/_import-this-week-in-rails.rb +++ b/_import-this-week-in-rails.rb @@ -70,7 +70,7 @@ def extract_author_url def extract_author_handle case url = extract_author_url when /hayford/ - 'siaw23' + 'Emmanuel Hayford' else url.split('/').last end diff --git a/_posts/2022-07-15-this-week-in-rails-rails-security-releases-improved-generator-option-handling-and-more-24774592.markdown b/_posts/2022-07-15-this-week-in-rails-rails-security-releases-improved-generator-option-handling-and-more-24774592.markdown index 9517ee0e..66596aac 100644 --- a/_posts/2022-07-15-this-week-in-rails-rails-security-releases-improved-generator-option-handling-and-more-24774592.markdown +++ b/_posts/2022-07-15-this-week-in-rails-rails-security-releases-improved-generator-option-handling-and-more-24774592.markdown @@ -2,42 +2,42 @@ layout: post title: "Rails security releases, Improved generator option handling and more..." categories: news -author: siaw23 +author: Emmanuel Hayford published: true date: 2022-07-15 --- -Hi! [Emmanuel](https://twitter.com/siaw23) here with updates from Rails over the last week. - -[Rails Versions 7.0.3.1, 6.1.6.1, 6.0.5.1, and 5.2.8.1 have been released!](https://discuss.rubyonrails.org/t/cve-2022-32224-possible-rce-escalation-bug-with-serialized-columns-in-active-record/81017) -A few days ago Rails released versions 7.0.3.1, 6.1.6.1, 6.0.5.1, and 5.2.8.1. These are security updates that impact applications that use serialised attributes on Active Record models. These updates, identified by CVE-2022-32224 cover a possible escalation to RCE when using YAML serialised columns in Active Record. - -[Allow opting out of the SameSite cookie](https://github.com/rails/rails/pull/45501) -You can now opt out of using _SameSite_ on your cookies by passing _same\_site: nil_. - -[Improve generator implied option handling](https://github.com/rails/rails/pull/45520) -_AppGenerator_ and _PluginGenerator_ implied options have gotten some improvements: Implied options will now be reported in your shell. Conflicting options will raise an error. Meta options and _--no-\*_ options are reported with more precision. - -[Add Formatting Full Messages with I18n section in ActiveRecordValidations guides](https://github.com/rails/rails/pull/45470) -Rails Guides received some love. There's now a section on the Active Record Validations guides to demonstrate how full validation messages can be formatted with the help of I18n. - -[Add --parent option to job generator to specify parent class of job](https://github.com/rails/rails/pull/45528) -There's now a superclass option in the job generator. It's possible to do _bin/rails g job process\_payment --parent=payment\_job_ to get _class ProcessPaymentJob \< PaymentJob; end_. - -[Add include\_seconds option to datetime\_local\_field](https://github.com/rails/rails/pull/45188) -According to [input elements of type time](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/time#time_value_format) browsers render time differently if you format time without the seconds bit. This PR adds an option to omit the seconds part of formatted time with _include\_seconds: false_. - -[Add timestamptz as a time zone aware type for PostgreSQL](https://github.com/rails/rails/pull/44601) -Previously, support for the _timestamptz_ type on the Postgres adapter was added, this caused issues in some cases where the newly-added _timestamptz_ was not considered timezone-aware attribute. This PR fixes the issue for Postgres users. - -[Common Table Expression support added "out-of-the-box](https://github.com/rails/rails/pull/37944) -You can now build sophisticated queries with Common Table Expressions using the _.with_ query method on models. The _.with_ allows the usage of Active Record relations without the need to manually build _Arel::Nodes::As_ nodes. - -[Add ActiveRecord::Base::generates\_token\_for](https://github.com/rails/rails/pull/44189) -With this PR, _signed\_id_ is relieved of token generation. Token generation is now directly associated with a record allowing record state to be tracked easily. - -[Add quarter to date/time](https://github.com/rails/rails/pull/45009) -_DateAndTime::Calculations_ gets a new method, _quarter_, that returns the quarter of the receiver's calendar year. Here are some examples: _Date.new(2010, 12, 25).quarter # =\> 4_ and _Date.new(2010, 4, 12).quarter # =\> 2_. - +Hi! [Emmanuel](https://twitter.com/siaw23) here with updates from Rails over the last week. + +[Rails Versions 7.0.3.1, 6.1.6.1, 6.0.5.1, and 5.2.8.1 have been released!](https://discuss.rubyonrails.org/t/cve-2022-32224-possible-rce-escalation-bug-with-serialized-columns-in-active-record/81017) +A few days ago Rails released versions 7.0.3.1, 6.1.6.1, 6.0.5.1, and 5.2.8.1. These are security updates that impact applications that use serialised attributes on Active Record models. These updates, identified by CVE-2022-32224 cover a possible escalation to RCE when using YAML serialised columns in Active Record. + +[Allow opting out of the SameSite cookie](https://github.com/rails/rails/pull/45501) +You can now opt out of using _SameSite_ on your cookies by passing _same\_site: nil_. + +[Improve generator implied option handling](https://github.com/rails/rails/pull/45520) +_AppGenerator_ and _PluginGenerator_ implied options have gotten some improvements: Implied options will now be reported in your shell. Conflicting options will raise an error. Meta options and _--no-\*_ options are reported with more precision. + +[Add Formatting Full Messages with I18n section in ActiveRecordValidations guides](https://github.com/rails/rails/pull/45470) +Rails Guides received some love. There's now a section on the Active Record Validations guides to demonstrate how full validation messages can be formatted with the help of I18n. + +[Add --parent option to job generator to specify parent class of job](https://github.com/rails/rails/pull/45528) +There's now a superclass option in the job generator. It's possible to do _bin/rails g job process\_payment --parent=payment\_job_ to get _class ProcessPaymentJob \< PaymentJob; end_. + +[Add include\_seconds option to datetime\_local\_field](https://github.com/rails/rails/pull/45188) +According to [input elements of type time](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/time#time_value_format) browsers render time differently if you format time without the seconds bit. This PR adds an option to omit the seconds part of formatted time with _include\_seconds: false_. + +[Add timestamptz as a time zone aware type for PostgreSQL](https://github.com/rails/rails/pull/44601) +Previously, support for the _timestamptz_ type on the Postgres adapter was added, this caused issues in some cases where the newly-added _timestamptz_ was not considered timezone-aware attribute. This PR fixes the issue for Postgres users. + +[Common Table Expression support added "out-of-the-box](https://github.com/rails/rails/pull/37944) +You can now build sophisticated queries with Common Table Expressions using the _.with_ query method on models. The _.with_ allows the usage of Active Record relations without the need to manually build _Arel::Nodes::As_ nodes. + +[Add ActiveRecord::Base::generates\_token\_for](https://github.com/rails/rails/pull/44189) +With this PR, _signed\_id_ is relieved of token generation. Token generation is now directly associated with a record allowing record state to be tracked easily. + +[Add quarter to date/time](https://github.com/rails/rails/pull/45009) +_DateAndTime::Calculations_ gets a new method, _quarter_, that returns the quarter of the receiver's calendar year. Here are some examples: _Date.new(2010, 12, 25).quarter # =\> 4_ and _Date.new(2010, 4, 12).quarter # =\> 2_. + [32 people contributed to Rails](https://contributors.rubyonrails.org/contributors/in-time-window/20220704-20220715) since the last time. Until next time! diff --git a/_posts/2022-07-29-this-week-in-rails-cache-invalidation-via-activestorage-blob-conditionally-executing-has_secure_password-etc-5af84562.markdown b/_posts/2022-07-29-this-week-in-rails-cache-invalidation-via-activestorage-blob-conditionally-executing-has_secure_password-etc-5af84562.markdown index ab6ebd5a..963d01e3 100644 --- a/_posts/2022-07-29-this-week-in-rails-cache-invalidation-via-activestorage-blob-conditionally-executing-has_secure_password-etc-5af84562.markdown +++ b/_posts/2022-07-29-this-week-in-rails-cache-invalidation-via-activestorage-blob-conditionally-executing-has_secure_password-etc-5af84562.markdown @@ -2,7 +2,7 @@ layout: post title: "Cache invalidation via ActiveStorage::Blob, Conditionally executing has_secure_password, etc" categories: news -author: siaw23 +author: Emmanuel Hayford published: true date: 2022-07-29 --- diff --git a/_posts/2022-08-19-this-week-in-rails-logging-raising-and-rescuing-errors-and-a-fix-for-a-query-method-564753b7.markdown b/_posts/2022-08-19-this-week-in-rails-logging-raising-and-rescuing-errors-and-a-fix-for-a-query-method-564753b7.markdown index 5b1f8b21..d7968f86 100644 --- a/_posts/2022-08-19-this-week-in-rails-logging-raising-and-rescuing-errors-and-a-fix-for-a-query-method-564753b7.markdown +++ b/_posts/2022-08-19-this-week-in-rails-logging-raising-and-rescuing-errors-and-a-fix-for-a-query-method-564753b7.markdown @@ -2,7 +2,7 @@ layout: post title: "Logging, raising and rescuing errors and a fix for a query method." categories: news -author: siaw23 +author: Emmanuel Hayford published: true date: 2022-08-19 --- diff --git a/_posts/2022-09-10-this-week-in-rails-rack-3-and-rails-7-0-4-6-1-7-and-6-0-6-releases-actiondispatch-cookies-etc-67ee6b56.markdown b/_posts/2022-09-10-this-week-in-rails-rack-3-and-rails-7-0-4-6-1-7-and-6-0-6-releases-actiondispatch-cookies-etc-67ee6b56.markdown index b85ad65c..7e2373bc 100644 --- a/_posts/2022-09-10-this-week-in-rails-rack-3-and-rails-7-0-4-6-1-7-and-6-0-6-releases-actiondispatch-cookies-etc-67ee6b56.markdown +++ b/_posts/2022-09-10-this-week-in-rails-rack-3-and-rails-7-0-4-6-1-7-and-6-0-6-releases-actiondispatch-cookies-etc-67ee6b56.markdown @@ -2,7 +2,7 @@ layout: post title: "Rack 3 and Rails 7.0.4, 6.1.7, and 6.0.6 releases, ActionDispatch::Cookies, etc" categories: news -author: siaw23 +author: Emmanuel Hayford published: true date: 2022-09-10 --- diff --git a/_posts/2022-09-30-this-week-in-rails-erb-in-yaml-keys-performance-boosts-a-new-option-for-querylogs-2b63a564.markdown b/_posts/2022-09-30-this-week-in-rails-erb-in-yaml-keys-performance-boosts-a-new-option-for-querylogs-2b63a564.markdown index 835c547d..6efb7344 100644 --- a/_posts/2022-09-30-this-week-in-rails-erb-in-yaml-keys-performance-boosts-a-new-option-for-querylogs-2b63a564.markdown +++ b/_posts/2022-09-30-this-week-in-rails-erb-in-yaml-keys-performance-boosts-a-new-option-for-querylogs-2b63a564.markdown @@ -2,7 +2,7 @@ layout: post title: "ERB in YAML keys, performance boosts, a new option for QueryLogs!" categories: news -author: siaw23 +author: Emmanuel Hayford published: true date: 2022-09-30 --- diff --git a/_posts/2022-10-21-this-week-in-rails-activerecord-querymethods-reselect-now-accepts-a-hash-performance-gains-and-a-fix-for-ciphertext_for-5254976c.markdown b/_posts/2022-10-21-this-week-in-rails-activerecord-querymethods-reselect-now-accepts-a-hash-performance-gains-and-a-fix-for-ciphertext_for-5254976c.markdown index dc83fc58..6b3a5427 100644 --- a/_posts/2022-10-21-this-week-in-rails-activerecord-querymethods-reselect-now-accepts-a-hash-performance-gains-and-a-fix-for-ciphertext_for-5254976c.markdown +++ b/_posts/2022-10-21-this-week-in-rails-activerecord-querymethods-reselect-now-accepts-a-hash-performance-gains-and-a-fix-for-ciphertext_for-5254976c.markdown @@ -2,7 +2,7 @@ layout: post title: "An Active Record improvement, performance gains and a bugfix!" categories: news -author: siaw23 +author: Emmanuel Hayford published: true date: 2022-10-21 --- diff --git a/_posts/2022-11-19-this-week-in-rails-the-rails-foundation-stimulus-outlets-api-bug-fixes-and-lots-of-improvements-33c69bff.markdown b/_posts/2022-11-19-this-week-in-rails-the-rails-foundation-stimulus-outlets-api-bug-fixes-and-lots-of-improvements-33c69bff.markdown index 0989d42a..edcaaa72 100644 --- a/_posts/2022-11-19-this-week-in-rails-the-rails-foundation-stimulus-outlets-api-bug-fixes-and-lots-of-improvements-33c69bff.markdown +++ b/_posts/2022-11-19-this-week-in-rails-the-rails-foundation-stimulus-outlets-api-bug-fixes-and-lots-of-improvements-33c69bff.markdown @@ -2,36 +2,36 @@ layout: post title: "The Rails Foundation, Stimulus Outlets API, bug fixes and lots of improvements!" categories: news -author: siaw23 +author: Emmanuel Hayford published: true date: 2022-11-19 --- -Boa noite! This is [Emmanuel](https://twitter.com/siaw23), bearer of good tidings. - -[Introducing: The Rails Foundation](https://rubyonrails.org/2022/11/14/the-rails-foundation) -In case you missed it, with eight founding members, Rails has started The Rails Foundation! Together, the founding members have contributed a total sum of $1,000,000 that will aid the foundation's mission to improve the documentation, education, marketing, and events in our ecosystem. More [here](https://rubyonrails.org/2022/11/14/the-rails-foundation). - -[Raise on assignment to readonly attributes -](https://github.com/rails/rails/pull/46105)Attributes that are marked as _attr\_readonly_ would previously fail silently, meaning data won't be written to the database when you tried to assign new values—with this PR, read-only attributes will raise an _ActiveRecord::ReadonlyAttributeError_ when an attempt is made to write to that read-only attribute. - -[Allow unscoping of preload and eager\_load associations](https://github.com/rails/rails/pull/45147) -This PR adds the ability to unscope _preloaded_ and _eager loaded_ associations, adding to the list of valid "unscoping" values like _where_, _select_ among others. - -[Add filtering of encrypted attributes in #inspect -](https://github.com/rails/rails/pull/46453)Previously, encrypted attributes could be added to an application's _filter\_parameters_ which would filter the attribute values from logs. This commit adds an additional config to enable adding encrypted attributes to records' _filter\_attributes_, which allows them to be filtered when models are inspected (such as in the console). - -[Initialize encrypted attributes when using #first\_or\_create or #first\_or\_initialize](https://github.com/rails/rails/pull/46493) -This fixes a bug where one would expect that encrypted values are initialized with the values provided but instead, the encrypted values were _nil_. - -[Stimulus gets an Outlets API](https://github.com/hotwired/stimulus/pull/576) -Around Hotwire, this PR received a warm welcome. I reached out to the author, [Marco Roth](https://twitter.com/marcoroth_), who whipped out a documentation that perfectly summarises the Outlet API: - -The Outlets API lets you reference Stimulus Controller instances and their _controller element_ from within another Stimulus Controller by using CSS selectors. The use of Outlets helps with cross-controller communication and coordination as an alternative to dispatching custom events on controller elements. - -Ruby on Rails saw [22 generous contributors](https://contributors.rubyonrails.org/contributors/in-time-window/20221111-20221118) in the last 7 days. - -Talk to you next week. - - -
Subscribe to get these updates mailed to you.
\ No newline at end of file +Boa noite! This is [Emmanuel](https://twitter.com/siaw23), bearer of good tidings. + +[Introducing: The Rails Foundation](https://rubyonrails.org/2022/11/14/the-rails-foundation) +In case you missed it, with eight founding members, Rails has started The Rails Foundation! Together, the founding members have contributed a total sum of $1,000,000 that will aid the foundation's mission to improve the documentation, education, marketing, and events in our ecosystem. More [here](https://rubyonrails.org/2022/11/14/the-rails-foundation). + +[Raise on assignment to readonly attributes +](https://github.com/rails/rails/pull/46105)Attributes that are marked as _attr\_readonly_ would previously fail silently, meaning data won't be written to the database when you tried to assign new values—with this PR, read-only attributes will raise an _ActiveRecord::ReadonlyAttributeError_ when an attempt is made to write to that read-only attribute. + +[Allow unscoping of preload and eager\_load associations](https://github.com/rails/rails/pull/45147) +This PR adds the ability to unscope _preloaded_ and _eager loaded_ associations, adding to the list of valid "unscoping" values like _where_, _select_ among others. + +[Add filtering of encrypted attributes in #inspect +](https://github.com/rails/rails/pull/46453)Previously, encrypted attributes could be added to an application's _filter\_parameters_ which would filter the attribute values from logs. This commit adds an additional config to enable adding encrypted attributes to records' _filter\_attributes_, which allows them to be filtered when models are inspected (such as in the console). + +[Initialize encrypted attributes when using #first\_or\_create or #first\_or\_initialize](https://github.com/rails/rails/pull/46493) +This fixes a bug where one would expect that encrypted values are initialized with the values provided but instead, the encrypted values were _nil_. + +[Stimulus gets an Outlets API](https://github.com/hotwired/stimulus/pull/576) +Around Hotwire, this PR received a warm welcome. I reached out to the author, [Marco Roth](https://twitter.com/marcoroth_), who whipped out a documentation that perfectly summarises the Outlet API: + +The Outlets API lets you reference Stimulus Controller instances and their _controller element_ from within another Stimulus Controller by using CSS selectors. The use of Outlets helps with cross-controller communication and coordination as an alternative to dispatching custom events on controller elements. + +Ruby on Rails saw [22 generous contributors](https://contributors.rubyonrails.org/contributors/in-time-window/20221111-20221118) in the last 7 days. + +Talk to you next week. + + +Subscribe to get these updates mailed to you.
diff --git a/_posts/2022-12-16-this-week-in-rails-documentation-on-preloading-stis-timehelpers-improvement-etc-fa5bbcaa.markdown b/_posts/2022-12-16-this-week-in-rails-documentation-on-preloading-stis-timehelpers-improvement-etc-fa5bbcaa.markdown index c2c73071..e6b7dd78 100644 --- a/_posts/2022-12-16-this-week-in-rails-documentation-on-preloading-stis-timehelpers-improvement-etc-fa5bbcaa.markdown +++ b/_posts/2022-12-16-this-week-in-rails-documentation-on-preloading-stis-timehelpers-improvement-etc-fa5bbcaa.markdown @@ -2,46 +2,46 @@ layout: post title: "Documentation on preloading STIs, TimeHelpers improvement, etc" categories: news -author: siaw23 +author: Emmanuel Hayford published: true date: 2022-12-16 --- -नमस्ते, This is [Emmanuel Hayford](https://twitter.com/siaw23) with some updates from Rails! - -[Hide changes to before\_committed! behaviour behind config](https://github.com/rails/rails/pull/46739) -This PR introduces a new configuration option that will enable _before\_committed!_ callbacks on all enrolled records in a transaction by default in Rails 7.1. Previously, callbacks were only run on the first copy of a record if there were multiple copies of the same record enrolled in a transaction. - -[TimeHelpers: include with\_usec keyword parameter on travel & freeze too](https://github.com/rails/rails/pull/46663) -_ActiveSupport::Testing::TimeHelpers_ now accepts a named _with\_usec_ argument to _freeze\_time_, _travel_, and _travel\_to_ methods. Passing true prevents truncating the destination time with _change(usec: 0)_. - -[Allow f.select to be called with a single hash containing options and HTML options](https://github.com/rails/rails/pull/46629) -_select_ can now be called with a single hash containing options and some HTML options. -Previously, this would not work as expected: - - _\<%= select :post, :author, authors, required: true %\>_ - - Instead, you needed to do this: - - _\<%= select :post, :author, authors, {}, required: true %\>_ - - Now, either form is accepted, for the following HTML attributes: _required_, _multiple_, _size_. - -[Fix inconsistent behavior in form helper date/time tags with options](https://github.com/rails/rails/pull/46678) -DateTime form helpers (_time\_field_, _date\_field_, _datetime\_field_, _week\_field_, _month\_field_) now accept an instance of _Time_, _Date_ and _DateTime_ as _:value_ option. - -Previously we had: -_\<%= form.datetime\_field :written\_at, value: Time.current.strftime("%Y-%m-%dT%T") %\>_ - -And now: -_\<%= form.datetime\_field :written\_at, value: Time.current %\>_ - -[Document four ways to preload STIs](https://github.com/rails/rails/commit/01bc3a4971068917e755bc0e15e6852cd65edfa9) -This PR documents a couple of ways to preload STIs. The document is on [Edge Rails Guides](https://edgeguides.rubyonrails.org/autoloading_and_reloading_constants.html) and you can read all about it. - -Thanks to the [26 contributors](https://contributors.rubyonrails.org/contributors/in-time-window/20221209-202201216) we had in the last week! - -Talk to you next week. - - -Subscribe to get these updates mailed to you.
\ No newline at end of file +नमस्ते, This is [Emmanuel Hayford](https://twitter.com/siaw23) with some updates from Rails! + +[Hide changes to before\_committed! behaviour behind config](https://github.com/rails/rails/pull/46739) +This PR introduces a new configuration option that will enable _before\_committed!_ callbacks on all enrolled records in a transaction by default in Rails 7.1. Previously, callbacks were only run on the first copy of a record if there were multiple copies of the same record enrolled in a transaction. + +[TimeHelpers: include with\_usec keyword parameter on travel & freeze too](https://github.com/rails/rails/pull/46663) +_ActiveSupport::Testing::TimeHelpers_ now accepts a named _with\_usec_ argument to _freeze\_time_, _travel_, and _travel\_to_ methods. Passing true prevents truncating the destination time with _change(usec: 0)_. + +[Allow f.select to be called with a single hash containing options and HTML options](https://github.com/rails/rails/pull/46629) +_select_ can now be called with a single hash containing options and some HTML options. +Previously, this would not work as expected: + + _\<%= select :post, :author, authors, required: true %\>_ + + Instead, you needed to do this: + + _\<%= select :post, :author, authors, {}, required: true %\>_ + + Now, either form is accepted, for the following HTML attributes: _required_, _multiple_, _size_. + +[Fix inconsistent behavior in form helper date/time tags with options](https://github.com/rails/rails/pull/46678) +DateTime form helpers (_time\_field_, _date\_field_, _datetime\_field_, _week\_field_, _month\_field_) now accept an instance of _Time_, _Date_ and _DateTime_ as _:value_ option. + +Previously we had: +_\<%= form.datetime\_field :written\_at, value: Time.current.strftime("%Y-%m-%dT%T") %\>_ + +And now: +_\<%= form.datetime\_field :written\_at, value: Time.current %\>_ + +[Document four ways to preload STIs](https://github.com/rails/rails/commit/01bc3a4971068917e755bc0e15e6852cd65edfa9) +This PR documents a couple of ways to preload STIs. The document is on [Edge Rails Guides](https://edgeguides.rubyonrails.org/autoloading_and_reloading_constants.html) and you can read all about it. + +Thanks to the [26 contributors](https://contributors.rubyonrails.org/contributors/in-time-window/20221209-202201216) we had in the last week! + +Talk to you next week. + + +Subscribe to get these updates mailed to you.
diff --git a/_posts/2023-01-13-this-week-in-rails-an-endpoint-for-uptime-monitors-an-improved-help-command-etc-0dfa7fc0.markdown b/_posts/2023-01-13-this-week-in-rails-an-endpoint-for-uptime-monitors-an-improved-help-command-etc-0dfa7fc0.markdown index 12b1524e..b7fab9cf 100644 --- a/_posts/2023-01-13-this-week-in-rails-an-endpoint-for-uptime-monitors-an-improved-help-command-etc-0dfa7fc0.markdown +++ b/_posts/2023-01-13-this-week-in-rails-an-endpoint-for-uptime-monitors-an-improved-help-command-etc-0dfa7fc0.markdown @@ -2,7 +2,7 @@ layout: post title: "An endpoint for uptime monitors, an improved help command, etc" categories: news -author: siaw23 +author: Emmanuel Hayford published: true date: 2023-01-13 --- diff --git a/_posts/2023-02-10-this-week-in-rails-parameter-filtering-and-an-improved-actionview-helpers-taghelper-token_list-3cd06e29.markdown b/_posts/2023-02-10-this-week-in-rails-parameter-filtering-and-an-improved-actionview-helpers-taghelper-token_list-3cd06e29.markdown index dd54dd79..f65542b9 100644 --- a/_posts/2023-02-10-this-week-in-rails-parameter-filtering-and-an-improved-actionview-helpers-taghelper-token_list-3cd06e29.markdown +++ b/_posts/2023-02-10-this-week-in-rails-parameter-filtering-and-an-improved-actionview-helpers-taghelper-token_list-3cd06e29.markdown @@ -2,7 +2,7 @@ layout: post title: "Parameter filtering and an improved ActionView::Helpers::TagHelper#token_list" categories: news -author: siaw23 +author: Emmanuel Hayford published: true date: 2023-02-10 --- diff --git a/_posts/2023-03-18-this-week-in-rails-testfixtures-fixture_path-deprecation-findermethods-find-support-for-composite-primary-key-values-87e6e69a.markdown b/_posts/2023-03-18-this-week-in-rails-testfixtures-fixture_path-deprecation-findermethods-find-support-for-composite-primary-key-values-87e6e69a.markdown index 84d61b5b..eda29903 100644 --- a/_posts/2023-03-18-this-week-in-rails-testfixtures-fixture_path-deprecation-findermethods-find-support-for-composite-primary-key-values-87e6e69a.markdown +++ b/_posts/2023-03-18-this-week-in-rails-testfixtures-fixture_path-deprecation-findermethods-find-support-for-composite-primary-key-values-87e6e69a.markdown @@ -2,7 +2,7 @@ layout: post title: "TestFixtures#fixture_path deprecation, FinderMethods#find support for composite primary key values, etc." categories: news -author: siaw23 +author: Emmanuel Hayford published: true date: 2023-03-18 --- diff --git a/_posts/2023-04-14-this-week-in-rails-a-week-dedicated-to-composite-primary-keys-32298f96.markdown b/_posts/2023-04-14-this-week-in-rails-a-week-dedicated-to-composite-primary-keys-32298f96.markdown index 59ac3075..447c9946 100644 --- a/_posts/2023-04-14-this-week-in-rails-a-week-dedicated-to-composite-primary-keys-32298f96.markdown +++ b/_posts/2023-04-14-this-week-in-rails-a-week-dedicated-to-composite-primary-keys-32298f96.markdown @@ -2,7 +2,7 @@ layout: post title: "A week dedicated to composite primary keys 😎" categories: news -author: siaw23 +author: Emmanuel Hayford published: true date: 2023-04-14 --- diff --git a/_posts/2023-06-09-this-week-in-rails-this-week-in-rails-june-9-2023-2e77d3dc.markdown b/_posts/2023-06-09-this-week-in-rails-this-week-in-rails-june-9-2023-2e77d3dc.markdown index 3e60c809..5fad9d78 100644 --- a/_posts/2023-06-09-this-week-in-rails-this-week-in-rails-june-9-2023-2e77d3dc.markdown +++ b/_posts/2023-06-09-this-week-in-rails-this-week-in-rails-june-9-2023-2e77d3dc.markdown @@ -2,16 +2,16 @@ layout: post title: " This Week In Rails - June 9, 2023" categories: news -author: siaw23 +author: Emmanuel Hayford published: true date: 2023-06-09 --- -Hi! [Emmanuel](https://twitter.com/siaw23) here writing from a train to Katowice! There have been quite a few developments in the Rails codebase over the last few weeks! Let's take a look at some of them, shall we? - -[Create a class level #with\_routing helper](https://github.com/rails/rails/pull/48407) -The _with\_routing_ helper can now be called at the class level. When called at this level, the routes will be set up before each test and reset after every test. For example: - +Hi! [Emmanuel](https://twitter.com/siaw23) here writing from a train to Katowice! There have been quite a few developments in the Rails codebase over the last few weeks! Let's take a look at some of them, shall we? + +[Create a class level #with\_routing helper](https://github.com/rails/rails/pull/48407) +The _with\_routing_ helper can now be called at the class level. When called at this level, the routes will be set up before each test and reset after every test. For example: + class RoutingTest < ActionController::TestCase with_routing do |routes| @@ -28,13 +28,13 @@ The _with\_routing_ helper can now be called at the class level. When called at end end - -[Allow composite primary key to be derived from schema](https://github.com/rails/rails/pull/47633) -When launching an application with a schema that incorporates composite primary keys, there will no longer be a warning issued, and the _ActiveRecord::Base#primary\_key_ value will not be set to _nil_ anymore. - -For instance, consider a table named _travel\_routes_ and a corresponding _TravelRoute_ model. In this case, the _TravelRoute.primary\_key_ value will be automatically derived as _["origin", "destination"]_, as demonstrated in the following example: - +[Allow composite primary key to be derived from schema](https://github.com/rails/rails/pull/47633) +When launching an application with a schema that incorporates composite primary keys, there will no longer be a warning issued, and the _ActiveRecord::Base#primary\_key_ value will not be set to _nil_ anymore. + + +For instance, consider a table named _travel\_routes_ and a corresponding _TravelRoute_ model. In this case, the _TravelRoute.primary\_key_ value will be automatically derived as _["origin", "destination"]_, as demonstrated in the following example: + create_table :travel_routes, primary_key: [:origin, :destination], force: true do |t| t.string :origin @@ -42,30 +42,30 @@ For instance, consider a table named _travel\_routes_ and a corresponding _Trave end class TravelRoute < ActiveRecord::Base; end - - -[Store connection\_pool in database-related exceptions](https://github.com/rails/rails/pull/48295) -When exceptions are raised from an adapter, it is beneficial to include the _connection\_pool_ as it offers additional context. This context includes information about the connection that triggered the exception, as well as details regarding the role and shard involved. - -[Add engine draw\_paths to app](https://github.com/rails/rails/pull/48388) -By adding the engine's draw paths to the application route set, the application gains the capability to access and utilize route files defined within engine paths. - -[Improve quoted parameters in mime types](https://github.com/rails/rails/pull/48397) -The _Mime::Type_ now offers support for handling types with parameters, ensuring proper handling of quotes. During the parsing of the accept header, the parameters preceding the 'q' parameter are retained, and if a matching mime-type is found, it is utilized accordingly. To maintain the existing functionality, a fallback mechanism has been implemented to search for the media-type without the parameters. - -[Support batching using composite primary keys and multiple column ordering](https://github.com/rails/rails/pull/48268) -The _find\_each_, _find\_in\_batches_, and _in\_batches_ methods now offer support for multiple column ordering. When these methods are used on a table with composite primary keys, it is possible to specify ascending or descending order for each individual key. Example: - + + +[Store connection\_pool in database-related exceptions](https://github.com/rails/rails/pull/48295) +When exceptions are raised from an adapter, it is beneficial to include the _connection\_pool_ as it offers additional context. This context includes information about the connection that triggered the exception, as well as details regarding the role and shard involved. + +[Add engine draw\_paths to app](https://github.com/rails/rails/pull/48388) +By adding the engine's draw paths to the application route set, the application gains the capability to access and utilize route files defined within engine paths. + +[Improve quoted parameters in mime types](https://github.com/rails/rails/pull/48397) +The _Mime::Type_ now offers support for handling types with parameters, ensuring proper handling of quotes. During the parsing of the accept header, the parameters preceding the 'q' parameter are retained, and if a matching mime-type is found, it is utilized accordingly. To maintain the existing functionality, a fallback mechanism has been implemented to search for the media-type without the parameters. + +[Support batching using composite primary keys and multiple column ordering](https://github.com/rails/rails/pull/48268) +The _find\_each_, _find\_in\_batches_, and _in\_batches_ methods now offer support for multiple column ordering. When these methods are used on a table with composite primary keys, it is possible to specify ascending or descending order for each individual key. Example: + Person.find_each(order: [:desc, :asc]) do |person| person.party_all_night! end - -That's it for today. In the past seven days, we had the privilege of witnessing the [contributions of 30](https://contributors.rubyonrails.org/contributors/in-time-window/20230602-20230609) amazing individuals to the Rails framework! - + +That's it for today. In the past seven days, we had the privilege of witnessing the [contributions of 30](https://contributors.rubyonrails.org/contributors/in-time-window/20230602-20230609) amazing individuals to the Rails framework! + Talk to you in the next one! Your weekly inside scoop of interesting commits, pull requests and more from [**Rails**](https://github.com/rails/rails). -Subscribe to get these updates mailed to you.
\ No newline at end of file +Subscribe to get these updates mailed to you.
diff --git a/_posts/2023-07-23-this-week-in-rails-a-much-needed-active-storage-documentation-with-a-new-option-to-trigger-has_secure_token-719cb867.markdown b/_posts/2023-07-23-this-week-in-rails-a-much-needed-active-storage-documentation-with-a-new-option-to-trigger-has_secure_token-719cb867.markdown index 4e4cd5e7..34efdb72 100644 --- a/_posts/2023-07-23-this-week-in-rails-a-much-needed-active-storage-documentation-with-a-new-option-to-trigger-has_secure_token-719cb867.markdown +++ b/_posts/2023-07-23-this-week-in-rails-a-much-needed-active-storage-documentation-with-a-new-option-to-trigger-has_secure_token-719cb867.markdown @@ -2,7 +2,7 @@ layout: post title: "A much needed Active Storage documentation with a new option to trigger has_secure_token " categories: news -author: siaw23 +author: Emmanuel Hayford published: true date: 2023-07-23 --- diff --git a/_posts/2023-09-22-this-week-in-rails-sqlite3-adapter-now-handles-default-functions-with-concatenation-and-and-supports-2f1f0ef3.markdown b/_posts/2023-09-22-this-week-in-rails-sqlite3-adapter-now-handles-default-functions-with-concatenation-and-and-supports-2f1f0ef3.markdown index 0ffc0b86..47bfc851 100644 --- a/_posts/2023-09-22-this-week-in-rails-sqlite3-adapter-now-handles-default-functions-with-concatenation-and-and-supports-2f1f0ef3.markdown +++ b/_posts/2023-09-22-this-week-in-rails-sqlite3-adapter-now-handles-default-functions-with-concatenation-and-and-supports-2f1f0ef3.markdown @@ -2,7 +2,7 @@ layout: post title: "SQLite3 adapter now handles default functions with concatenation and supports supports_insert_returning?" categories: news -author: siaw23 +author: Emmanuel Hayford published: true date: 2023-09-22 --- diff --git a/_posts/2023-10-13-this-week-in-rails-special-rails-world-edition-rails-7-1-1-solid-queue-solid-cache-turbo-8-etc-4ef25a8f.markdown b/_posts/2023-10-13-this-week-in-rails-special-rails-world-edition-rails-7-1-1-solid-queue-solid-cache-turbo-8-etc-4ef25a8f.markdown index 58957a87..32445c97 100644 --- a/_posts/2023-10-13-this-week-in-rails-special-rails-world-edition-rails-7-1-1-solid-queue-solid-cache-turbo-8-etc-4ef25a8f.markdown +++ b/_posts/2023-10-13-this-week-in-rails-special-rails-world-edition-rails-7-1-1-solid-queue-solid-cache-turbo-8-etc-4ef25a8f.markdown @@ -2,7 +2,7 @@ layout: post title: "Special Rails World Edition: Rails 7.1.1, Solid Queue, Solid Cache, Turbo 8, etc." categories: news -author: siaw23 +author: Emmanuel Hayford published: true date: 2023-10-13 --- diff --git a/_posts/2024-02-24-this-week-in-rails-enhanced-assert_broadcasts-file-support-for-logger-outputs-and-more-25a0f981.markdown b/_posts/2024-02-24-this-week-in-rails-enhanced-assert_broadcasts-file-support-for-logger-outputs-and-more-25a0f981.markdown index e8615ae8..70a13f32 100644 --- a/_posts/2024-02-24-this-week-in-rails-enhanced-assert_broadcasts-file-support-for-logger-outputs-and-more-25a0f981.markdown +++ b/_posts/2024-02-24-this-week-in-rails-enhanced-assert_broadcasts-file-support-for-logger-outputs-and-more-25a0f981.markdown @@ -2,48 +2,52 @@ layout: post title: "Enhanced assert_broadcasts, file support for Logger outputs and more!" categories: news -author: siaw23 +author: Emmanuel Hayford og_image: assets/images/this-week-in-rails.png published: true date: 2024-02-24 --- -Hope you're having a lovely weekend. [Emmanuel](https://twitter.com/siaw23) here with yet another batch of Rails updates for you! - - [assert\_broadcasts returns the messages that were broadcast -](https://github.com/rails/rails/pull/47025)_assert\_broadcasts_ now not only confirms the broadcast but also provides access to the messages that were broadcast. This enhancement, similar to what we have in _assert\_emails_, facilitates additional analyses of the transmitted messages. - -Here's an example: - -_def test\_emails\_more\_thoroughly - email = assert\_emails 1 do - ContactMailer.welcome.deliver\_now - end - assert\_email 'Hi there', email.subject - - emails = assert\_emails 2 do - ContactMailer.welcome.deliver\_now - ContactMailer.welcome.deliver\_later - end - assert\_email 'Hi there', emails.first.subject -end_ [Autosaving has\_one sets foreign key attribute when unchanged -](https://github.com/rails/rails/pull/50901)This pull request corrected an issue where the _has\_one_ association would erroneously set the foreign key attribute even when unchanged. This behavior was inconsistent with the autosaving mechanism of _belongs\_to_ associations and could lead to unintended side effects, such as triggering an _ActiveRecord::ReadOnlyAttributeError_ when the foreign key attribute is set as read-only. - -[Fix override existing join types in the query in the where.associated method](https://github.com/rails/rails/pull/51078) -The fix now ensures that the association is joined using the correct join type (either INNER JOIN or LEFT OUTER JOIN) based on the existing joins in the scope. This prevents inadvertent overrides of existing join types and guarantees consistency in the resulting SQL queries. This pull request fixes that. For example: _form\_for url: "" { # ... }_ would not generate a matching CSRF token which would eventually raise an _InvalidAuthenticityToken_ error. - -[Add parameter filter capability for redirect locations](https://github.com/rails/rails/pull/51131) -Here we add a parameter filter capability for redirect locations. This feature utilizes the _config.filter\_parameters_ to determine which parameters should be filtered. As a result, redirects will not display filtered parameters, ensuring sensitive information remains protected. A redirect location with filtered parameters will now look like: _Redirected to secret.foo.bar?username=roque&password=[FILTERED]_. - -[Support filenames in Logger.logger\_outputs\_to?](https://github.com/rails/rails/pull/51125) -Well, this one is straightforward, we can now do stuff like _Logger.logger\_outputs\_to?('/var/log/rails.log')_. - -That's it! We saw[43 people contribute](https://contributors.rubyonrails.org/contributors/in-time-window/20240216-20240224) to Rails this past week! - -Take care :) - - +Hope you're having a lovely weekend. [Emmanuel](https://twitter.com/siaw23) here with yet another batch of Rails updates for you! + + [assert\_broadcasts returns the messages that were broadcast +](https://github.com/rails/rails/pull/47025)_assert\_broadcasts_ now not only confirms the broadcast but also provides access to the messages that were broadcast. This enhancement, similar to what we have in _assert\_emails_, facilitates additional analyses of the transmitted messages. + +Here's an example: + +```ruby +def test_emails_more_thoroughly + email = assert_emails 1 do + ContactMailer.welcome.deliver_now + end + assert_email 'Hi there', email.subject + + emails = assert_emails 2 do + ContactMailer.welcome.deliver_now + ContactMailer.welcome.deliver_later + end + assert_email 'Hi there', emails.first.subject +end +``` + +[Autosaving has\_one sets foreign key attribute when unchanged +](https://github.com/rails/rails/pull/50901)This pull request corrected an issue where the _has\_one_ association would erroneously set the foreign key attribute even when unchanged. This behavior was inconsistent with the autosaving mechanism of _belongs\_to_ associations and could lead to unintended side effects, such as triggering an _ActiveRecord::ReadOnlyAttributeError_ when the foreign key attribute is set as read-only. + +[Fix override existing join types in the query in the where.associated method](https://github.com/rails/rails/pull/51078) +The fix now ensures that the association is joined using the correct join type (either INNER JOIN or LEFT OUTER JOIN) based on the existing joins in the scope. This prevents inadvertent overrides of existing join types and guarantees consistency in the resulting SQL queries. This pull request fixes that. For example: _form\_for url: "" { # ... }_ would not generate a matching CSRF token which would eventually raise an _InvalidAuthenticityToken_ error. + +[Add parameter filter capability for redirect locations](https://github.com/rails/rails/pull/51131) +Here we add a parameter filter capability for redirect locations. This feature utilizes the _config.filter\_parameters_ to determine which parameters should be filtered. As a result, redirects will not display filtered parameters, ensuring sensitive information remains protected. A redirect location with filtered parameters will now look like: _Redirected to secret.foo.bar?username=roque&password=[FILTERED]_. + +[Support filenames in Logger.logger\_outputs\_to?](https://github.com/rails/rails/pull/51125) +Well, this one is straightforward, we can now do stuff like _Logger.logger\_outputs\_to?('/var/log/rails.log')_. + +That's it! We saw[43 people contribute](https://contributors.rubyonrails.org/contributors/in-time-window/20240216-20240224) to Rails this past week! + +Take care :) + + Your weekly inside scoop of interesting commits, pull requests and more from [**Rails**](https://github.com/rails/rails). -Subscribe to get these updates mailed to you.
\ No newline at end of file +Subscribe to get these updates mailed to you.