This week in Rails: SQL colors, reversible column defaults and more!

Hello? This is your captain Kasper speaking.

We're just about ready to take to the skies for our weekly cruise through the news. I took a flight course once, and walked away from the crash in flying colors. If my instructor had made it out, I'm sure he would be proud too.

Look at us, we're already taking off - hey, is that light supposed to be blinking?

Featured

This Week's Rails Contributors

26 daring pilots brimmed the horizon with their commits this week. There were loops and barrel rolls galore - you should have been there! Oh, but you can. See the last item if you feel the need for speed (and contributing).

When SQL Output met Rainbows

In Rails 5 you'll see your SQL has gotten a fresh coat of paint - several in fact. Now common SQL statements appear in color when sprouting up in your logs. Check the link for the color map.

change\_column\_default Gains Reversible Syntax

Gone are the thrills of remembering past defaults, when you changed it for a column. Both from and to can be passed now: change_column_default(:posts, :state, from: nil, to: "draft")

If all your life's ROFLMAO'ing have left you with ass left to laugh off, you'll be ready to migrate and roll back on the floor laughing the remainder of your rear right off over this.

Improved

Windows Users Needs the Latest Development Kit

If you're a Windows user and witness to the horror of rails new failing with native gems not being able to be installed - rejoice! You need the latest Development Kit version, which our getting started guide will now tell you.

Fixed

where with Association Names are Closer to 4.2

To prevent ambiguity and potential collisions, association names in where are assumed to reference the table name.

default\_render Can Yield When Template is Missing

When a Rails 5 controller action have no corresponding template, Rails renders head :no_content. Before libraries were hooking into the missing template exception being thrown. Now default_render takes a block and the hook is back.

One More Thing™

Feel the need to contribute?

From time to time DHH opens issues on Rails about stuff he'd like implemented. As long as someone hasn't laid claim to it in the comments (or is assigned) it's yours to take a stab at.

That's a wrap

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

Have you been thinking about writing for us, but you're scared of putting yourself out there? Don't worry, you can help our editors improve their writing with thoughtful critique and general grammar policing.

You up for that? Tell Godfrey today.

This week in Rails: Rails 4.2.3, Rails 4.1.12 and more!

Hey there!

This is Claudio, celebrating a historical moment on the road to a better framework for everyone.

Featured

This week's Rails contributors

28 people contributed to the framework by having their commits merged into rails/rails this week. Thanks and keep up the good work!

Rails 4.2.3 and 4.1.12 have been released!

What are you waiting for? Run bundle update rails and get four months of updates in your codebases!

New Stuff

Integrate protected_attributes with strong parameters

Are you still on Rails 3? Do you wish you could use strong parameters? Check out this commit to protected_attributes… it might just make your day.

Sprockets 4.0 is coming

The development of rails/sprockets moves on and… needs your help! If you'd like to contribute to its next version, don't hesitate to contact any Rails core team member.

Fixed

Raise the proper error on namespaced-association type mismatch

Assigning a wrong value to a namespaced association used to raise NameError, but will now correctly raise ActiveRecord::AssociationTypeMismatch

One More Thing™

Kasper Timm Hansen is a Rails Committer team member

Kasper started contributing one year ago and has not stopped (240 commits and counting)! Thanks for being awesome and for your wonderful blog posts.

That's a wrap

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

Have you been thinking about writing for us, but you're scared of putting yourself out there? Don't worry, you can help our editors improve their writing with thoughtful critique and general grammar policing.

You up for that? Tell Godfrey today.

[ANN] Rails 4.2.3 and 4.1.12 have been released!

Hi everyone,

I am happy to announce that Rails 4.2.3 and 4.1.12 have been released.

No regressions were found so these releases include the same changes that the release candidates.

CHANGES since 4.1.11

To view the changes for each gem, please read the changelogs on GitHub:

Full listing

To see the full list of changes, check out all the commits on GitHub.

CHANGES since 4.2.2

To view the changes for each gem, please read the changelogs on GitHub:

Full listing

To see the full list of changes, check out all the commits on GitHub.

SHA-1

If you'd like to verify that your gem is the same as the one I've uploaded, please use these SHA-1 hashes.

Here are the checksums for 4.1.12:

$ shasum *4.1.12*
c4f8aebcd59011e47d373a99413dad210e3d4bbd  actionmailer-4.1.12.gem
ce8868972769ad56b93b7b98585d64804d6d8174  actionpack-4.1.12.gem
2d6e6c6212bff10993394c63b56ce434342c9a47  actionview-4.1.12.gem
9a462b3ad2cfaf5f7914869efd5e8c62e54064b0  activemodel-4.1.12.gem
c0d65ed4f79115f7a9901d60201e720a7f556335  activerecord-4.1.12.gem
97fd3230896d900923dc650e788ccaaf3b06d692  activesupport-4.1.12.gem
9f6db196328b302c4c3a7ff3a1c7cd1a191221cc  rails-4.1.12.gem
8c7c04045df2eebc69e54c8426def69eca0f8bf6  railties-4.1.12.gem

Here are the checksums for 4.2.3:

$ shasum *4.2.3*
f02da8c3896d4c8cd208b7c555c2c2235e44ce0e  actionmailer-4.2.3.gem
d824941013ba3616aa643d4c5016d00bf2dc028f  actionpack-4.2.3.gem
53982ad7579069c2a5de4939bb8c689550bdd2ab  actionview-4.2.3.gem
280e774caf7335aba1b50441b4890803d18a666c  activejob-4.2.3.gem
0d2160b37223703d167cfd5a8cb358029ccbacd9  activemodel-4.2.3.gem
8799d638cc5cdbd59296392f0f1014a051378517  activerecord-4.2.3.gem
1dc5e9cba144dc9794bc4ebed19a8528b7287a76  activesupport-4.2.3.gem
0ef8f13382996c3480d09900e34988aae85f0886  rails-4.2.3.gem
0fa6b51c3e9f70f0ce9fb1d1977169537d19ae86  railties-4.2.3.gem

I'd like to thank you all, every contributor who helped with this release.

[ANN] Rails 4.2.3.rc1 and 4.1.12.rc1 have been released!

Hi everyone,

I am happy to announce that Rails 4.2.3.rc1 and 4.1.12.rc1 have been released.

If no regressions are found expect the final release this Thursday, on June 25, 2015. If you find one, please open an issue on GitHub and mention me (@rafaelfranca) on it, so that we can fix it before the final release.

CHANGES since 4.1.11

To view the changes for each gem, please read the changelogs on GitHub:

Full listing

To see the full list of changes, check out all the commits on GitHub.

CHANGES since 4.2.2

To view the changes for each gem, please read the changelogs on GitHub:

Full listing

To see the full list of changes, check out all the commits on GitHub.

SHA-1

If you'd like to verify that your gem is the same as the one I've uploaded, please use these SHA-1 hashes.

Here are the checksums for 4.1.12.rc1:

$ shasum *4.1.12.rc1*
5309022944d12fcf015f8993db2c69f66d0fa9c4  actionmailer-4.1.12.rc1.gem
7e66207c9bd27bd07966a93e4a14abbf792920d7  actionpack-4.1.12.rc1.gem
17a9c55edf3988a28af2017f901bcbcc7257c99a  actionview-4.1.12.rc1.gem
78a04199bb509617d672e62076a704849b90650d  activemodel-4.1.12.rc1.gem
b7ffcf6ac2c9929d18e406dfb9fd6b9858d3d893  activerecord-4.1.12.rc1.gem
c8bbbc325547bd3707b445e79c95406e057037c2  activesupport-4.1.12.rc1.gem
a3307e12472796620e1e7b3b71ce1e0c6a112854  rails-4.1.12.rc1.gem
dfd11e7529f6b21049644c16b62e53d898ce4013  railties-4.1.12.rc1.gem

Here are the checksums for 4.2.3.rc1:

$ shasum *4.2.3.rc1*
3af2c0a834e8f6c26656720419bedc2935df4424  actionmailer-4.2.3.rc1.gem
bdf102b742a963d3b1697e4e876900c1644fe502  actionpack-4.2.3.rc1.gem
94020ee0a2372d601de8c2e62a672ea35d1548cd  actionview-4.2.3.rc1.gem
f9429285835d11a9de31f51349d35f75bf242a02  activejob-4.2.3.rc1.gem
92cedde54d1c3951ed431825b36e6868b5c79142  activemodel-4.2.3.rc1.gem
9cafdd1bd85ca8a61c73f2cb31973cc4074c252f  activerecord-4.2.3.rc1.gem
8c2740af13ff4e664edef95f49a1e7536168e8fa  activesupport-4.2.3.rc1.gem
a1eeaaa8e7bb3a2f9ee29bf5525eaea54313a4a6  rails-4.2.3.rc1.gem
8aa764a9befa9ecad476bb7d07403da4ceea67a6  railties-4.2.3.rc1.gem

I'd like to thank you all, every contributor who helped with this release.

This week in Rails: Security Releases, Enumerable Relations and more!

Hey there!

I'm just glad we all made to this Friday. This is Washington again pulling together a few stories for our weekly newsletter on Rails.

Featured

This week's Rails contributors

Keeping our tradition let's start with the 32 splendid contributors that made their commits to rails/rails this week. Keep in mind a ton other people also helped by creating issues and helping the core team with PR reviews.

Rails security releases 3.2.22, 4.1.11 and 4.2.2

Time to upgrade your applications. Five announcements landed on Rails security mailing list this week. Consider joining that list as well if you haven't yet.

Improved

Include Enumerable in ActiveRecord::Relation

After a couple years Rails core team seems to have changed its mind and Enumerable is finally included into active record relations. Things change and I believe that's fine.

Fixed

Autoload ActiveRecord::RecordInvalid

Thanks to the awesome open source community it was noted ActiveRecord::RecordInvalid was not being eager loaded as expected. The fix was backported to all supported branches.

Deprecated

Remove ContentLength middleware from the defaults

As per an old change on Rack spec Rails 5 will no longer ship with ContentLength middlleware by default.

Passing hash as first parameter into ActionController::Head is deprecated

The way to go now is to explicitly pass the status first then pass the options hash as a second parameter.

That's a wrap

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

Have you been thinking about writing for us, but you're scared of putting yourself out there? Don't worry, you can help our editors improve their writing with thoughtful critique and general grammar policing.

You up for that? Tell Godfrey today.

Rails 3.2.22, 4.1.11 and 4.2.2 have been released and more

Hi everyone!

Rails 3.2.22, 4.1.11 and 4.2.2 have been released, along with web console and jquery-rails plugins and Rack 1.5.4 and 1.6.2.

These releases contain security fixes, so please upgrade as soon as possible!

The security fixes for 4.1.11 and 4.2.2 are:

In order to make upgrading as smooth as possible, we've only included commits directly related to each security issue.

The security fix for 3.2.22 is:

Differently from the Rails 4 releases, Rails 3.2.22 includes all the commits from the 3-2-stable branch. This mean that now Rails 3.2 supports Ruby 2.2.

The commits for 3.2.22 can be found here, the commits for 4.1.11 can be found here, and the commits for 4.2.2 can be found here.

Web Console

We are also releasing Web Console 2.1.3 that contains the fix for the following issue:

The commits can be found here.

jquery-ujs and jquery-rails

We are also releasing jquery-ujs 1.0.4 and jquery-rails 3.1.3 and 4.0.4 that includes fix for the following issue:

The commits for jquery-rails 3.1.3 can be found here, the commits for jquery-rails 4.0.4 can be found here, and the commits for jquery-ujs 1.0.4 can be found here.

Rack

Rack 1.5.4 and Rack 1.6.2 have also been released, which include fixes for the following issue:

The commits for rack 1.5.4 can be found here, and the commits for rack 1.6.2 can be found here.

SHA-1

Here are the checksums for Rails 3.2.22:

$ shasum *3.2.22*
cc56be2f49baeeccc0da87b740f23d0ac7bd2d24  actionmailer-3.2.22.gem
d20fd24d9049fad99ea5405a265ca7c9690af378  actionpack-3.2.22.gem
0454b4bd49a1a423e1ef6231a5cb510ca48e0cb8  activemodel-3.2.22.gem
d9e51980eb4892089a29531c1fea69cabe9511e4  activerecord-3.2.22.gem
3754c63826f09b6b10bd0ca749646f76fbe195c6  activeresource-3.2.22.gem
4da01bbf6e03326c24c261c3d65a8c0b563f8663  activesupport-3.2.22.gem
0386d4d55b52d1348e024cb237e3b81126ce6c46  rails-3.2.22.gem
56575ff805b432be10fa79080c25c790947999f2  railties-3.2.22.gem

Here are the checksums for Rails 4.1.11:

$ shasum *4.1.11*
154856eb9c940e8fb5c999b08c748ce82e8a1197  actionmailer-4.1.11.gem
fa9a8271d8c19af89f8cf46c9a5bfd0b3ece1226  actionpack-4.1.11.gem
340678573b91ad305b9c2b07844d0628dbcf6a8d  actionview-4.1.11.gem
c56dc176a7ac0690d4f59472f28b36a664221d5c  activemodel-4.1.11.gem
711334da9e88d8d2606b4e12df115b093fb3a1b1  activerecord-4.1.11.gem
b714633af191481332797ed09f62fdd784363fb1  activesupport-4.1.11.gem
9fc1c823457ffe51cc6f52de2960035149621e15  rails-4.1.11.gem
1640674035171d0eb36ff91da9ea8d86f2137261  railties-4.1.11.gem

Here are the checksums for Rails 4.2.2:

$ shasum *4.2.2*
a093bdd43d732416f02b1cc39edc4f839b27cc69  actionmailer-4.2.2.gem
51dc701f026f3a84a779287459996f36023877f9  actionpack-4.2.2.gem
6ae3231fa1e6bbd07b4d1bf7b124654b39f3e048  actionview-4.2.2.gem
16e607a30b41d000bae2e848c11ef472264a5d94  activejob-4.2.2.gem
e667fb6dee998be2d1d01086467fa3fe2ca58dff  activemodel-4.2.2.gem
394cc4d39e8c84c2aed5b25c352cd6b2903ab686  activerecord-4.2.2.gem
b4b91de89a8c6f223bed5c01a7e578956d4a2bf7  activesupport-4.2.2.gem
a9e286e6799bde99e1449706854b910b5c466302  rails-4.2.2.gem
dd46d7f599fb883c1d3fd6b5ec8fcfd61628b869  railties-4.2.2.gem

Here is the checksum for Web Console 2.1.3:

$ shasum web-console-2.1.3*
60aed82466891904d7348583d67ec7dabce3a176  web-console-2.1.3.gem

Here are the checksums for jquery-rails 3.1.3 and 4.0.4:

$ shasum jquery-rails*.gem
691b6ec57ee08f8ef80bae3e8c09a4442d2f7d5c  jquery-rails-3.1.3.gem
159b4127ebbaba708cbed2921d1d1b00134ee834  jquery-rails-4.0.4.gem

Here are the checksums for Rack 1.5.4 and 1.6.2:

$ shasum rack-*.gem
d71ea9c90d7ef2a0787722f233da8fcbfb5e55d5  rack-1.5.4.gem
85d34dbf068cda5cf36432984da8ccf81c3d1be5  rack-1.6.2.gem

This week in Rails: Rails API, fun with minitest and more!

Howdy folks!

My name is Todd and I'll be your guide through the land of Rails this week. Straight from the comfort of my couch with awful lumbar support, I proudly present bad posture and the highlights from This Week in Rails.

Featured

This week's Rails Contributors

42 people made Rails even more awesome this week.

Rails API has landed on master!

After 52 days, lots of great comments, and a ton of incredible work by Santiago and Jorge, Rails API has been merged into master and will be released as part of Rails 5!

New Stuff

Optional scaffold.css

If you've ever wanted the ability to avoid generating scaffold.css when performing a scaffold, you're in luck. Simply use the --no-scaffold-stylesheet switch and you're good to go!

Improved

Better minitest integration for Rails' test runner

The new Rails test runner has been modified to take better advantage of minitest's extension system.

Added a Point object for Postgres point types

Rails 5 will deprecate the current behavior for Postgres point types. Moving forward, the Postgres adapter will return a Point object instead of an Array.

Reversible remove_foreign_key

Migrations using remove_foreign_key can now be automatically reverted with rake db:rollback without manually defining the down operations.

Fixed

Prefix and suffix options for enums

This allows you to add a prefix or suffix to enum's auto-generated methods. Useful if you have multiple enums with the same values.

Fixed ignore_blank for required select fields

This change will now cause an ArgumentError to be raised in the event ignore_blank is set to false on a required select field.

Fixed abstract class fixtures with belongs_to

Fixes an issue where using belongs_to in abstract classes would result in a crash when loading test fixtures.

That's a wrap

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

Have you been thinking about writing for us, but you're scared of putting yourself out there? Don't worry, you can help our editors improve their writing with thoughtful critique and general grammar policing.

You up for that? Tell Godfrey today.

This week in Rails: DateTime vs Time, summer student projects and more!

Hello everyone!

This is Marcel making my 'initial commit' with awesome help from Kasper, your friendly ghost editor. Ten minutes from the lovely Jamaican shores, here are the headlines from This Week in Rails.

Featured

This week's Rails Contributors

56 people helped make Rails even more awesome this week.

When should you use DateTime?

Ever wondered what is the difference between DateTime and Time? Checkout this enlightening gist on when you would use each which also landed in the ruby documentation.

Google Summer of Code – Web Console

Follow one of our Google Summer of Code student Hiroyuki on his thoughts, experiments and progress with the web-console browser extension project.

Rails Girls Summer of Code

Meet the 16 official teams that will be participating in the 2015 Rails Girls Summer of Code. We wish them the best of luck.

New Stuff

Custom configurations can be required

Sometimes there's a configuration your app simply needs to function. Now that important client secret can raise if it hasn't been set. Just go out with a bang: Rails.application.kitty_litter_supreme.client_secret!

Action Mailer queue name is configurable

Currently all mails sent with deliver_later are put in the mailers queue. This patch keeps that default but allows the queue name to be configured globally via config.action_mailer.deliver_later_queue_name. See also related documentation commit.

Improved

Use inline Gemfile when reporting bugs

No longer do you need to write a physical Gemfile when submitting bug reports, as Bundler 1.10.3 now supports inline gems. Of note, when an inline Gemfile is used, bundle exec is not supported.

Use block variable instead of global

As it turns out using a block variable instead of a "magic" global variable is not only faster but easier to read.

Enumerable#pluck supports multiple attributes

This allows easier integration with Active Record, such that ActiveRecord::Base#pluck will now use Enumerable#pluck if the relation is loaded, without needing to hit the database.

Deprecated

Remove assert_template and assigns()

In order to discourage ties in the controller tests to the internal structure of how your views are organized, assigns and assert_template have both been removed and extracted to the gem rails-controller-testing.

Fixed

Apply Active Record suppression to all saves

Active Record's suppress is now being applied to non-bang save and update methods. It was also missing from create_* methods provided by singular associations. See gist for more details.

That's a wrap

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

Have you been thinking about writing for us, but you're scared of putting yourself out there? Don't worry, you can help our editors improve their writing with thoughtful critique and general grammar policing.

You up for that? Tell Godfrey today.

This week in Rails: Enumerable#pluck, SQLite Collation and lots more

Hello everyone!

This is Vipul , happily reporting from a Simmering Summer 😎. Pour yourself a drink 🍹, sit back, relax and enjoy, as we go through these hot off the press changes.

Featured

This week's Rails Contributors

43 people helped make Rails even awesome this week. Checkout the pulse page for more details.

New Stuff

Enumerable#pluck

Enumerable#pluck has just landed on master, providing similar functionality as Active Record's #pluck.

This allows for something like [{ name: "David" }, { name: "Rafael" }, { name: "Aaron" }].pluck(:name) to get everyone's names. Pretty handy!

Improved

Collation support in SQLite

Active Record now supports specifying a collation function for SQLite string columns.

Default procs in Attributes API

With the new Attributes API, it is now possible to specify a proc as the default values for an attribute, which allows for runtime-generated default values such as attribute :year, :integer, default: -> { Time.now.year }. See also these related changes.

Preserve MySQL's sql\_mode with strict: :default

By default, Rails overrides MySQL's sql_mode setting with sql_mode=STRICT_ALL_TABLES to prevent silent data loss. While this is helpful, it has the unfortunate side-effect of overriding any user customizations.

If you prefer to manage this yourself, you can now specify strict: :default in your connection's config and Rails will leave your sql_mode alone. (STRICT_ALL_TABLES is still highly recommended though!)

Deprecated

Deprecate render nothing: true

If you are using render nothing: true, you should start replacing it with head :ok, which does the same thing and is more semantic. This option will go away permanently in Rails 5.1.

Deprecate Relation#uniq

The superficial similarity between Relation#uniq and Array#uniq has been a source of confusion, which led to the addition of Relation#distinct which better communicates what is happening under the hood.

The recent discussion on #20198 put the final nail in the coffin for Relation#uniq and its friends, #uniq! and #uniq_value. These methods are deprecated and scheduled for removal in Rails 5.1, so you might want to start using #distinct, #distinct! and #distinct_value soon.

That's a wrap

That's all for This week in Rails. As always, there are many 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!

This week in Rails: try'ing with Delegator, schema cache and a lot more

Hey everyone, this is Prathamesh. Back with latest spells and bindings from magical world of Rails. Keep your wands ready!

Featured

This week's Rails Contributors

39 people got commits into rails/rails this week. And 7 of them made their first patch in this week! Checkout the pulse page for more details.

New Stuff

Support for try with Delegator

Delegator will now respond to try rather than delegating it to the underlying object. Phew! The surprising behavior when using try with normal objects and delegators is gone finally.

Improved

Copy schema cache to new connection pool after fork

Active Record does all the heavy lifting of maintaining and creating connection pools. It just got better. Thanks to this patch, it will copy the schema cache of old connections pools to the new ones if one already exists.

Fixed

Quoted sequence names now work with serial?

Quoted sequence names in PostgreSQL will work properly now with serial? method. Before this patch, the serial? method would return false if the sequence name was quoted. Finally it's fixed.

One More Thing™

Integer#positive? and Integer#negative? in Ruby core

Last week Integer#positive? and Integer#negative? were added to Rails and this week they became part of Ruby core. Hooray!

That's a wrap

That's all for This week in Rails. As always, there are many 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!