Goodbits logo black in white circle

This week in Rails

Past issues
May 23 Jun 6

Jun 2 2014

Issue #12


Logo for This week in Rails

Issue #12

Welcome to This week in Rails, your weekly inside scoop of interesting commits, pull requests and more from Rails.

Featured

Rails 4.1.2.rc1 and 4.0.6.rc1 released

These maintenance releases contain bug fixes for their respective release series. If you have some time this week, help the Rails team by giving them a spin in your app and report any issues you found!

New Stuff

Deprecated all `*_filter` callbacks in favor of `*_action` callbacks

You probably saw this one coming – the classic before_filter-family hooks in the controller will be deprecated and eventually removed from Rails in favour of the before_action-family hooks.

(Note: there is an ongoing discussion around when this deprecation should happen, due to concerns from gem authors who need to support multiple versions of Rails. Therefore, there is a good chance that this commit will be eventually reverted and deferred to a later release. Nevertheless, you should start using the new names in your application if possible.)

How to benchmark your pull requests

If you submit a pull request that modifies a performance "hot path", it would be helpful for the reviewer if you could attach a benchmark to ensure that your patch did not introduce any performance regression. (Similarly, if your PR is to address a performance issue, a benchmark would help to know that it actually works.) This new section in the contributors' guide shows you how to do just that.

New default script: `bin/setup`

New applications generated with Rails 4.2 will come with a bin/setup file. Similar to how seeds.rb was added for managing seed data, this script is the conventional place for bootstrapping your application.

Documentation for Rails' versioning scheme

This new section in the guides documented the meaning of each segment in Rails' version string.

Fixed

How to cherry-pick from Active Support

If you need to cherry-pick any features from Active Support in your project, you should always require active_support before requiring the individual features/files you need.

Skip individual tests upon `Dalli::RingError`

Memcached failures is one of the most common false-failures on Rails' travis CI setup. If you have similar problems in your CI setup, you might want to check out this neat little trick by @matthewd to reduce these random CI failures.

Escape user input before appending them on the page

Since Rails seamlessly handle most of the input-sanitization for us, it is quite easy to forget about these problems when switching into JavaScript-land for your frontend code. (As pointed out in the commit message, this particular bug is unlikely to cause problems as the routing error page is disabled by default on production.)

Not Fixed

Removed deprecated `Numeric#ago` and friends

If you have code that relies on implicit conversion from Numeric to seconds (e.g. 5.ago), you should replace them with an explicit call to #seconds (e.g. 5.seconds.ago) as the former will cease to work in Rails 4.2+.

Wrapping up

And that's it for this issue of This week in Rails. I say this every week, but this week there's an usually huge list of interesting things happening on Rails than I can cover here, so I encourage you to check them out!

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. If you liked what you read, please 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