2024-02-24
- Emmanuel Hayford
(from Ruby on Rails)
Hope you’re having a lovely weekend. Emmanuel here with yet another batch of Rails updates for you!
Hope you’re having a lovely weekend. Emmanuel here with yet another batch of Rails updates for you!
assert_broadcasts returns the messages that were broadcast
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
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
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.
Add parameter filter capability for redirect locations
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?
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 to Rails this past week!
Take care :)
Your weekly inside scoop of interesting commits, pull requests and more from Rails.
Subscribe to get these updates mailed to you.
[Technology]
🌎 https://rubyonrails.org/2024/2/24/this-week-in-rails-enhanced-assert_broadcasts-file-support-for-logger-outputs-and-more-25a0f981
[🧠] [v2] article_embedding_description: {:llm_project_id=>"Unavailable", :llm_dimensions=>nil, :article_size=>4581, :llm_embeddings_model_name=>"textembedding-gecko"}
[🧠] [v1/3] title_embedding_description: {:ricc_notes=>"[embed-v3] Fixed on 9oct24. Only seems incompatible at first glance with embed v1.", :llm_project_id=>"unavailable possibly not using Vertex", :llm_dimensions=>nil, :article_size=>4581, :poly_field=>"title", :llm_embeddings_model_name=>"textembedding-gecko"}
[🧠] [v1/3] summary_embedding_description: {:ricc_notes=>"[embed-v3] Fixed on 9oct24. Only seems incompatible at first glance with embed v1.", :llm_project_id=>"unavailable possibly not using Vertex", :llm_dimensions=>nil, :article_size=>4581, :poly_field=>"summary", :llm_embeddings_model_name=>"textembedding-gecko"}
[🧠] As per bug https://github.com/palladius/gemini-news-crawler/issues/4 we can state this article belongs to titile/summary version: v3 (very few articles updated on 9oct24)
{"id"=>4264,
"title"=>"Enhanced assert_broadcasts, file support for Logger outputs and more!",
"summary"=>"Hope you’re having a lovely weekend. Emmanuel here with yet another batch of Rails updates for you!",
"content"=>"Hope you’re having a lovely weekend. Emmanuel here with yet another batch of Rails updates for you!
\n\nassert_broadcasts returns the messages that were broadcast\n
\nassert_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.
\nHere’s an example:
\n\ndef test_emails_more_thoroughly\n email = assert_emails 1 do\n ContactMailer.welcome.deliver_now\n end\n assert_email 'Hi there', email.subject\n\n emails = assert_emails 2 do\n ContactMailer.welcome.deliver_now\n ContactMailer.welcome.deliver_later\n end\n assert_email 'Hi there', emails.first.subject\nend\n
\n\nAutosaving has_one sets foreign key attribute when unchanged
\nThis 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.
\n\nFix override existing join types in the query in the where.associated method
\nThe 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.
\n\nAdd parameter filter capability for redirect locations
\nHere 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].
\n\nSupport filenames in Logger.logger_outputs_to?
\nWell, this one is straightforward, we can now do stuff like Logger.logger_outputs_to?(‘/var/log/rails.log’).
\n\nThat’s it! We saw 43 people contribute to Rails this past week!
\n\nTake care :)
\n\nYour weekly inside scoop of interesting commits, pull requests and more from Rails.
\n\nSubscribe to get these updates mailed to you.
",
"author"=>"Emmanuel Hayford",
"link"=>"https://rubyonrails.org/2024/2/24/this-week-in-rails-enhanced-assert_broadcasts-file-support-for-logger-outputs-and-more-25a0f981",
"published_date"=>Sat, 24 Feb 2024 00:00:00.000000000 UTC +00:00,
"image_url"=>nil,
"feed_url"=>"https://rubyonrails.org/2024/2/24/this-week-in-rails-enhanced-assert_broadcasts-file-support-for-logger-outputs-and-more-25a0f981",
"language"=>nil,
"active"=>true,
"ricc_source"=>"feedjira::v1",
"created_at"=>Mon, 01 Apr 2024 20:13:47.324358000 UTC +00:00,
"updated_at"=>Mon, 21 Oct 2024 18:03:57.633705000 UTC +00:00,
"newspaper"=>"Ruby on Rails",
"macro_region"=>"Technology"}