Goodbits logo black in white circle

This week in Rails

Past issues
Aug 8 Aug 29

Aug 22 2014

Issue #20 (Rails 4.2 Edition)


Logo for This week in Rails

Issue #20

ZOMG! We made it to the twentieth issue! Thank you for your support along the way, I wouldn't be able to do this without it!

My apologies to those who sat in front of their computer refreshing their inboxes last Friday. (Hopefully you've learned to not do that by now!) The Rails team have been working super hard in the last two weeks as we put in the finishing touches for the new releases, so I hope this is worth the wait!

This is going to be a very long issue! For those of you reading this with Gmail, you might have to click the "View entire message" link to read everything.

Featured

Rails 4.2.0 beta1: Active Job, Deliver Later, Adequate Record, Web Console

Rails 4.2.0 beta1: Active Job, Deliver Later, Adequate Record, Web Console

This week we pushed a beta release for Rails 4.2 with tons of new features. If you have been following this newsletter you probably heard about most of these already ;) Click through for the announcement blog post or read the release notes to learn more.

Rails 5.0 will require Ruby 2.2

Rails 5.0 will require Ruby 2.2

Also buried in the Rails 4.2 announcement blog post: Rails 5.0 is scheduled for next spring/summer, and it will require Ruby 2.2. This allow us to adopt the latest and greatest language features, such as keyword arguments. We can also rely on symbol GC and eliminate an entire class of security bugs!

Rails Contributors: Rails 4.2 Edition

Rails Contributors: Rails 4.2 Edition

The 4.2 Beta release is made possible with the help of these 488 contributors. If you ever bump into them, give them a big hug!

[HELP WANTED] Document Rails 4.2

[HELP WANTED] Document Rails 4.2

Currently, the documentation for 4.2 needs lots of love. If you would like to contribute to the release, here is your chance!

Releases

[SECURITY] Rails 4.0.9 and 4.1.5

[SECURITY] Rails 4.0.9 and 4.1.5

If you haven't already, you should consider upgrading to 4.0.9 and 4.1.5 as soon as possible. These are security releases, which means that they contain only the relevant security patch and nothing else, so upgrading should be straightforward.

[PATCH] Rails 4.1.6.rc1 and 4.0.10.rc1

[PATCH] Rails 4.1.6.rc1 and 4.0.10.rc1

Earlier this week, we also did a maintenance release for the 4.1 and 4.0 series with lots of bug fixes. (Did I mention it was a busy week?) We have discovered a regression since, so you will probably see another RC releases soon™.

New Stuff

Active Job landed in master

Active Job landed in master

Active Job was one of the biggest features included in Rails 4.2. It is a queue abstract/adapter layer that enables developers (and gem authors as well) to schedule background jobs using a uniform API across all Rails apps without worrying too much about the backend (e.g. sidekiq or resque). (By default, it ships with an inline runner that executes the job immediately.)

The first use case for this feature is in Action Mailer: it now comes with a #deliver_later method that does what you would expect! (Consequently, #deliver is deprecated in favor the new #deliver_now.)

Smart ETags

Smart ETags

This pull requests makes the ETags generated from Rails smarter: by including the digest of the corresponding template in the ETag, Rails will know to invalidate the cached content when the template has changed. (This is relevant when you generate an ETags from the controller, as opposed to those automatically generated by Rack::ETag.)

Add a `required` option to the model generator

Add a `required` option to the model generator

This new option takes care of adding the required validation on the belongs to association, as well as adding the NOT NULL and foreign key constraints in the migration. Neat, eh?

Add option to stop swallowing errors on transactional callbacks

Add option to stop swallowing errors on transactional callbacks

Currently, Active Record only log errors that happened in after_commit and after_rollback callbacks. In Rails 5.0, this behavior would change to simply bubbling the errors, maintaining the parallel between other types of callbacks. To ease the transition, you can enable the new behavior today using a configuration flag in Rails 4.2 (or you will receive a warning otherwise).

Enable gzip compression by default

Enable gzip compression by default

If you are using Rails to serve your asset files, this pull request is going to improve your client-side performance by enabling gzip compression!

Production log level now defaults to :debug on new applications

Production log level now defaults to :debug on new applications

This gives you more detailed information that might come in handy when debugging issues your users are experiencing.

Fixed

Stronger Parameters

Stronger Parameters

This pull request adds #to_h to ActionController::Parameters which returns a new hash with any unpermitted keys stripped out. This is a compromise to migrate away from inheriting Hash in Rails 5.0, so you might want to take notes and start calling to_h on your params before calling Hash methods on it.

Randomized testing in your app

Randomized testing in your app

If you are using the default testing stack in Rails 4.2, your application's tests will be randomized by default, to reflect the default of this setting on Minitest itself.

We don't suck <3

We don't suck <3

If your tests are order-dependent though, you can simply call my_tests_are_order_dependent! at the top of your test case, thanks to this lovely commit!

Finally, none of our tests are order_dependent!

Finally, none of our tests are order_dependent!

Thanks to a joint effort from several contributors (including some of our GSoC students), the Rails test suite can finally be run randomized!

Not Fixed

Extract `respond_with` to the `responders` gem

Extract `respond_with` to the `responders` gem

respond_with and the class-level respond_to methods have been extracted from Rails into the responders gem. If you are using this feature, you'll have to add that to your Gemfile when upgrading to Rails 4.2.

Wrapping up

And that's it for this issue of This week in Rails. As always, there are a lot more changes on Rails than what I can cover in this newsletter, so I encourage you to check them out yourself!

If you have any feedback for me, please feel free to email me or let me know on twitter! Thank you for reading! <3 <3 <3

P.S. Feel free to share this newsletter with your Rails friends!











Previous Issues

  • Sep 27

    Autumn is here, and so is Rails 7 Alpha 2! 🍂

  • Sep 17

    Rails 7 alpha released

  • Sep 12

    Bye-bye Byebug, Hello jsbundling and cssbundling!

  • Aug 28

    Remove default reliance on Sass and more!

  • Aug 21

    Good-bye classic mode, --skip-puma, --skip-gemfile.. hello weekday_options_for_select!

  • Aug 13

    ESM importmap and Marginalia

  • Aug 8

    Active Record goodies and more!

  • Jul 31

    Favicons, InvalidAuthenticityToken message gains, Journey optimizations and more!

  • Jul 23

    Active record improvements and much more

  • Jul 19

    Performance and parallel testing improvements and more!

Load More

© 2014-2025 This week in Rails.

Goodbits logo square wrapper Published on Goodbits