Saturday, January 31, 2015

This week in Rails: Relation#or, file fixtures, kwargs and more!

Posted by gregmolnar

It is that time of the week again!

This is Greg, bringing you this week’s interesting commits and pull requests from Rails.

This week’s Rails contributors

Let’s start with a big thank you for all the people who helped this week to make Rails better!

New Stuff

Added #or to ActiveRecord::Relation

A long waited feature is added to Active Record and from now on you can combine two Active Record relations with the or operator.


With this addition to ActiveSupport::Testing there is no need to write custom helpers for testing features requiring a sample file (i.e. file uploads).

Use kwargs in the test’s HTTP methods

Support for keyword arguments is added to the HTTP methods of the controller tests. An example of the new syntax:

post :create, params: { y: x }, format: :json


Improved performance of integration tests

delegate turned out to be a bottleneck at the URL generation in the integration tests. With this patch the integration tests of the applications should have a speedup.

Allow hyphenated names for plugins

From now on you can generate a Rails plugin with a hyphenated name (i.e. namespaced engines).


*_via_redirect integration test methods are deprecated

The *_via_redirect methods are deprecated but do not fear, you can use follow_redirect! in your test suite for the same behaviour.


Fixed HTTP basic authentication nil issue

When request.authorization returned nil, Rails raised a NoMethodError, but this is fixed now.

AR::Relation#group accepts SQL reserved keywords

This patch allows you to group by SQL reserved keywords with the group method of Active Record.

One More Thing™

Arthur Nogueira Neves is a Rails Committer

Please welcome our newest Rails Committer!

Wrapping up

That’s all for This week in Rails. As always, there are more changes than we have room to cover here, but feel free to check them out yourself!

P.S. If you enjoyed this newsletter, why not share it with your friends? :) If you wish to be part of this project please don’t hesitate to contact Godfrey – there’re a lot of ways you could help make this newsletter more awesome!