rails changelog


Here's the latest scoop on our updates and fixes! 🌟

New Features

  • Minimum in test case should be picked after conditions: We've revamped the way minimum values are picked in test cases by adding specific conditions. This ensures our tests are more accurate and reliable. 🛠️

Bugfixes

  • Parameterize table_name when constructing insert alias: Fixed a pesky syntax error that popped up when the table name included the database name. Now, the code handles this scenario smoothly without any hiccups. 🚫🔧
  • Fix a typo in Active Record and PostgreSQL guide: Corrected a typo that could cause confusion in the Active Record and PostgreSQL guide. Clear and precise documentation for the win! 📚✨
  • [FIX] Pluck columns should correctly cast types when using PostgreSQL: Resolved an issue where pluck columns were not correctly casting types in PostgreSQL. Now, type casting works flawlessly, even with conflicting column names. 🎯

Improvements

  • Add usage guidelines to transaction.active_record docs: Spruced up the transaction.active_record documentation by adding usage guidelines. Now, developers can easily follow best practices for using transactions in ActiveRecord. 📘💡
  • Add ensure to reset table name in tests: Introduced an ensure block to reset the table name in tests, ensuring no lingering changes affect subsequent tests. Consistency and reliability are key! 🔄

That's all for now! Keep coding and stay awesome! 🚀

Included Commits

2024-06-03T12:16:30 See commit

This commit fixes a typo in the Active Record and PostgreSQL guide. The typo was likely causing confusion or errors for users following the guide. By correcting this mistake, the guide will now provide accurate and helpful information for users working with Active Record and PostgreSQL. This small change demonstrates the importance of attention to detail in documentation to ensure users have a smooth and successful experience with the technology.

Files changed

2024-06-03T21:22:21 See commit

This commit adds usage guidelines to the documentation for transaction.active_record. The guidelines provide instructions and best practices for using transactions in ActiveRecord, such as when to use transactions, how to handle errors within a transaction, and how to ensure data consistency. By including these guidelines in the documentation, developers using ActiveRecord will have a better understanding of how to effectively use transactions in their applications.

Overall, this commit aims to improve the clarity and usability of the transaction.active_record documentation by providing clear and concise guidelines for developers. These guidelines will help developers make use of transactions in a more effective and efficient manner, ultimately leading to better data integrity and reliability in their applications.

Files changed

2024-06-04T06:07:04 See commit

This commit fixes an issue where pluck columns were not correctly casting types when using PostgreSQL. The changes include modifications to the calculations_test.rb file in the ActiveRecord test cases. Specifically, the commit adds assertions to test the pluck method's ability to correctly cast types for columns like approved, last_read, and written_on. Additionally, the commit includes a new assertion to test the pluck method's ability to handle conflicting column names by using the min function for written_on and replies_count columns.

Overall, this commit addresses a bug related to type casting in the pluck method when using PostgreSQL. By adding new assertions and modifying existing ones in the calculations_test.rb file, the commit ensures that pluck columns now correctly cast types for various columns, including handling conflicting column names.

Files changed

  • activerecord/test/cases/calculations_test.rb
2024-06-04T06:17:47 See commit

In this commit, the minimum value in a test case is now being picked based on certain conditions. The changes were made in the calculations_test.rb file in the activerecord/test/cases directory. The specific changes include modifying the pluck method to now select the minimum value of certain attributes for a given topic. This change ensures that the minimum value is correctly selected based on the specific conditions provided in the test case.

Overall, this commit enhances the functionality of the pluck method in calculating the minimum value for specific attributes in a given topic. By making these adjustments, the test case now accurately selects the minimum value based on the conditions specified, improving the overall accuracy and reliability of the testing process.

Files changed

  • activerecord/test/cases/calculations_test.rb
2024-06-05T13:52:10 See commit

In this commit, the code in the insert_all_test.rb file has been modified to add an ensure block that resets the table name to "books" after a test is run. This change ensures that the table name is properly reset after the test is completed, preventing any potential issues with the table name being incorrectly set for subsequent tests. The commit includes one addition and no deletions, with the specific change being made to the test_insert_all_when_table_name_contains_database method.

Overall, this commit improves the reliability and consistency of the tests by ensuring that the table name is reset to its original state after each test is run. This helps to maintain the integrity of the test environment and prevents any unintended side effects from lingering changes to the table name. The addition of the ensure block provides a safeguard to ensure that the table name is always properly reset, enhancing the overall quality of the testing process.

Files changed

  • activerecord/test/cases/insert_all_test.rb
2024-05-31T14:55:49 See commit

This commit addresses an issue where a syntax error would occur when the table_name contains the database name. By parameterizing the table_name when constructing the insert alias, the code is now able to handle this scenario without causing any errors. This change ensures that the database name within the table_name is properly handled and does not disrupt the functionality of the code.

Overall, this update improves the robustness and reliability of the code by addressing a potential source of syntax errors. By parameterizing the table_name, the code is now able to handle a wider range of scenarios without encountering issues related to the database name being included within the table_name. This change enhances the overall stability and performance of the code when working with table names that contain the database name.

Files changed