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 :)
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 :)