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!
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.)
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 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.
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.
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.
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.)
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!