Sort Your Rails Models By The Order of their AssociationsSort your Rails models by the order of their belongs_to associations using ActiveRecord::Reflection.
Shaping Rails to Your Needs, Customizing Rails Generators using Thor TemplatesTemplates are an easy way to customize your Rails generators to fix repetitive tasks and make your life easier.
Rails 7.1 Introduces Default Health Check ControllerRails 7.1 now introduces a default health check endpoint for health checks.
Rails initializers you don't know about - InflectionsRails comes with a lot of initializers. In this post, we will look at the inflections.rb initializer and how we can use it.
Rails 7.1 db:prepare to load schema if the database already exists but is emptyRails 7.1 introduces a new feature to allow db:prepare to load schema if the database already exists but is empty. Also, it will dump the schema after migrations are run.
Rails allow opting out of the SameSite cookie attribute when setting a cookieRails 7.1 introduces a new feature to allow opting out of the SameSite cookie attribute when setting a cookie.
Rails "ActionController::Parameters.to_h" can now receive a blockActionController::Parameters.to_h will now receive a block just like Hash#to_h and achieve parity. This gives the ability to customize the way parameters are passed to the controller.
The Ultimate Guide to Gemfile and Gemfile.lockIn-depth overview of what a Gemfile is and how a Gemfile works.
Rails now provides pattern matching support for ActiveModelRails now provides pattern matching support for ActiveModel (and transitively ActiveRecord)
Rails 7 adds ActiveRecord::Relation#structurally_compatible?Rails 7 adds ActiveRecord::Relation#structurally_compatible? to provide an easy way to check if two relations are structurally compatible before running `or` or `and` query on it.
Rails 7 optimizes remove_columns to use a single SQL statement when supportedRails 7 remove_columns will now trigger a single SQL statement to remove all columns if the database supports it, instead of querying multiple SQL statements for removing individual columns.
Rails 7 allows loading nested locales in the engineRails 7 allows loading nested locales inside the `/locales` directory by default for better organization in larger apps.
Rails 7 generators will raise errors if an attribute type is invalidRails 7 generators will validate the type by checking if it is of a default migration type and will raise an error if it is invalid.
Ruby 3.1 adds Enumerable#compact and Enumerator::Lazy#compactRuby 3.1 adds Enumerable#compact and Enumerator::Lazy#compact to return a copy of `self` with all `nil` elements removed.
Rails 7 adds maximum and minimum methods to EnumerableRails 7 adds `Enumerable#maximum` and `Enumerable#minimum` to calculate the maximum or minimum from extracted elements of an enumerable.