This week in Rails: new release candidates, concurrent migrations and more!

####

Hi there everyone o/

Washington here putting together another weekly Rails issue for the most awesome community.

Rails 4.2.5.rc2 and Rails 4.1.14.rc2 are out

Please take a minute or two to update your project Gemfile and run the build on the RCs. Spotting regressions now means they’re fixed in another RC rather than a new point release some month(s) away.

This Week’s Rails Contributors

As of 17h15min, UTC -3, 28 contributors made their commits to Rails master. Some of those for the very first time. Welcome!

Make migrations concurrent safe (using advisory locks)

MySQL and Postgres Active Record adapters were enhanced to avoid confusing behaviour or exceptions when running migrations on multi-instance clusters. See the issue as well for more details.

New Stuff

Add enabled flag to public_file_server settings

Good old serve_static_files is being deprecated as of Rails 5 in favor of public_file_server.enabled so we have all static asset options under the same public_file_server key.

Improved

Deprecate exception#original_exception in favor of exception#cause

Exception wrapping implementation got a bit simpler this week by using Ruby’s built in Exception#cause, available since version 2.1.

Require only necessary concurrent-ruby classes

Another concurrent-ruby bump and related load time improvements.

Don’t allow arbitrary data in :back urls

This was reported quite a while ago, but now someone stepped up to the plate and followed it through. Rails got a bit safer again, thanks to the community. ❤️

Allow passing an env to config_for

Sanity checking configuration files in other environments just got easier as well.

Wrapping Up

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.

Until next time!

[ANN] Rails 4.2.5.rc2 and 4.1.14.rc2 have been released!

Hi everyone,

I am happy to announce that Rails 4.2.5.rc2 and 4.1.14.rc2 have been released.

If no regressions are found expect the final release this Wednesday, on November 11, 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.13

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.4

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.14.rc2:

$ shasum *4.1.14.rc2*
7c546616f87939a01807a55e78ed8494acc7c2ec  actionmailer-4.1.14.rc2.gem
8f80145fa65746c8a0a5492ae6213f447bbb0aaa  actionpack-4.1.14.rc2.gem
f0186571e89372ffbea47fbc4a3b901e46b0760e  actionview-4.1.14.rc2.gem
558e4eabcd1cec6a5089348dfd5a6f949d7606cc  activemodel-4.1.14.rc2.gem
0db20360a75bfa74b6539df190af8920bd75ff2f  activerecord-4.1.14.rc2.gem
3a2608827b895234e3d3b99e95df29344e31f875  activesupport-4.1.14.rc2.gem
5a9bd84dbc15a06128fc71d197cd6ee3d783114a  rails-4.1.14.rc2.gem
742da45dc3d63b43c882d7ce1d71f682bd1149c0  railties-4.1.14.rc2.gem

Here are the checksums for 4.2.5.rc2:

$ shasum *4.2.5.rc2*
d8fa2707c7f88aaf033b6ef2f0e39b5805823a8b  actionmailer-4.2.5.rc2.gem
80e43409399bcf3377c4a1aab803c442a635cadb  actionpack-4.2.5.rc2.gem
21d4a14dfec4ccfb321d51c1a73854f7c90003e0  actionview-4.2.5.rc2.gem
c1e258c2ed4b4e91b6d2f31d1a2020179043b5ba  activejob-4.2.5.rc2.gem
72f86e0ccb22e1b0f2980b500f1d7ced4d887da1  activemodel-4.2.5.rc2.gem
dc8cbcd461f3d3b583ac18c2d3c4fc5a8857ce72  activerecord-4.2.5.rc2.gem
40b5b72140f30bc97b7dc9e30c12d86ade0692b8  activesupport-4.2.5.rc2.gem
d3b7ee2ef71d9a9a4cb0a237162a67393549eeed  rails-4.2.5.rc2.gem
5969ef6ef00239fb5d2b012eb23068f1620a2563  railties-4.2.5.rc2.gem

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

This spooky week in Rails: bidirectional destroys, indexed errors and horror!

####

Beware of those,
In forests reigned by cawing crows
Who feel the fright, a stormy friday night

Your weekly Rails news, pick and choose
As we weave, this;
All Hallow’s Eve

Bet you didn’t expect to get spooked the day before Halloween, well, that’s our trick-a-trété. What? That’s what the french say — don’t ask.

This Week’s Rails Contributors

This week 42 contributors gathered in the town square, pitchforks in hand, and chased bugs out of Rails and up the mill.

That’s what mob programming is all about. I assume.

Bidirectional Destroys

Say, a USA and a USSR model employed defensive measures to destroy the other if they we’re destroyed. Before they’d keep destroying the other, now they’re more peaceful only destroying each other once. Good thing it’s a fictional example 😁

Nested attributes indexes errors by insertions

Have models with accepts_nested_attributes_for? The macro nestled out an index_errors option, so errors attach to a specific model in the submitted array.

There’s comments on the pull request, if you want to improve it further.

New Stuff

Relation gets left_outer_joins

There’s now an explicit way to do this specific join — abstracted away in includes before.
For those who want to be left out, er… join in!

Improved

Many to many relationships count a little more

While calling count on a has_and_belongs_to_many relationship was correctly counted, amping up the inclusion made threw off the count. Now you can use includes and have things counted correctly again.

Sanitizing Order

You’d have to remember to sanitize arguments you passed to order, which, if you have an example like the one in the pull request, is a pain. No more.

HashWithIndifferentAccess defaults with to_hash objects

Passing an object that responds to to_hash to HashWithIndifferentAccess.new now respects the default values and default proc if any of those are there.

One more thing™

Correction: Active Support delegation to block, args or arg

Last week, we incorrectly said this change would raise exceptions. What really happens is delegate now works with block, args or arg if those light your Jack-o’-lantern.

Wrapping Up

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.

Until next time!

Also if you really want to be scared, look yourself in the mirror! Boom, nailed it!

[ANN] Rails 4.2.5.rc1 and 4.1.14.rc1 have been released!

Hi everyone,

I am happy to announce that Rails 4.2.5.rc1 and 4.1.14.rc1 have been released.

If no regressions are found expect the final release this Wednesday, on November 4, 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.13

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.4

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.14.rc1:

$ shasum *4.1.14.rc1*
6c4513c4f2a57d11fe8e9abafacde175a284a0fc  actionmailer-4.1.14.rc1.gem
27eeb9c788be0323eb459edda2b4d09418f37c40  actionpack-4.1.14.rc1.gem
2f70d52109b8be2c2dfbc57992fb1070a3a49fc5  actionview-4.1.14.rc1.gem
d3aafc6b61999fa0c9a363dfc626c93df9e460a2  activemodel-4.1.14.rc1.gem
55ea63bcca5925652956d194e8dbf4aca1780888  activerecord-4.1.14.rc1.gem
f771aa7d47c8a390449f577024d9335f7487294e  activesupport-4.1.14.rc1.gem
b3a16b8372ec44927196d38a12cc72fc97ad54c8  rails-4.1.14.rc1.gem
f1be582957f2494e13462f464e28afbaf938d233  railties-4.1.14.rc1.gem

Here are the checksums for 4.2.5.rc1:

$ shasum *4.2.5.rc1*
95125668842661dda2db412a45226f9b1219b522  actionmailer-4.2.5.rc1.gem
d9c6b7e38f9eab5975ca2549cb88b6700a0acdfd  actionpack-4.2.5.rc1.gem
f40ad9c7a5cd2c4b14f96615fdf5627d4fcaa9f3  actionview-4.2.5.rc1.gem
edcc197c162d64d663cf1049851105777c9a41ff  activejob-4.2.5.rc1.gem
eff7203c26da06c76a667428c70dc8741afac67e  activemodel-4.2.5.rc1.gem
c719ffeaffbd0f3bc1e23ed1db32df84662c0460  activerecord-4.2.5.rc1.gem
311d02a075d1669eba52b026ac60b834e02e96c6  activesupport-4.2.5.rc1.gem
810f02ff2930062f269340bc7df4e4e213a168a3  rails-4.2.5.rc1.gem
e7f842b19b4e3f67625d3df3127ed99392f19bed  railties-4.2.5.rc1.gem

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

Matthew joins Rails core; José joins Rails alumni

Please join us in welcoming Matthew Draper to the Rails core team!

Matthew is a kick-ass collaborator. He’s gone above and beyond PRs and technical contributions (which are sharp and on-point) by mentoring student groups, by coaching beginning Rails developers through their first apps alongside experienced developers working through design decisions & tradeoffs, by volunteering forserving on the Rails security team, and by emerging as a natural steward of the Rails way. His mindfulness for programmer experience & happiness puts Rails—the framework and our community—in good hands. Welcome, Matthew! 👏

Also, please join us in ushering José Valim into the halls of Rails alumni. José was once a Rails patch monster without peer, and has gone on to create the Elixir programming language and build a fantastic community around it. Gratefully, for everything: Thank you, José. ❤️

This week in Rails: 4000 Subscribers, File Server Headers Config and More!

####

Hello everyone! This is Roque with the latest from the Rails world.

Sending out to over 4000 subscribers!

This Week in Rails just crossed 4000 subscribers. Thanks to all subscribers and collaborators! Stay tuned!

This Week’s Rails Contributors

26 people contributed to Rails this week, including 5 first-time contributors! If you are interested in becoming a contributor, you can have a look at the issues list.

New Stuff

Create a config for file server headers

Rails now allows any static file header to be defined using the configuration option config.public_file_server.headers.
This also deprecates the former option static_cache_control that would only apply the header Cache-Control.

Force SSL in mails

The config.force_ssl option will now force mails to use the protocol https for the host setup in config.action_mailer.default_url_options.

Allow multiple root routes in same scope level

Lets say your application has multiple root endpoints depending on a constraint. You can now describe them using root entries in your config/routes.rb file instead of having to use get statements.

Improved

Make Active Record increment! and decrement! concurency safe

This will prevent issues when performing updates from different instances of a same record.

The where method will now let you know when an argument type is unsupported

where will raise ArgumentError on unsupported types.

Wrapping Up

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.

Until next time!

This week in Rails: Performance, Test Helper Changes, Mailer Preview Improvements and More!

####

tap tap

Is this thing on?

Hey, everyone! Welcome to the latest edition of This Week in Rails - your one stop shop for all the goings-on in the Rails universe. My name is Todd and I’ll be your guide. Let’s get this party started!

This Week’s Rails Contributors

We had 41 extraordinary people commit to Rails this past week, including 15 (!) newcomers. Wanna see your name on this list? Check out the list of issues.

New Stuff

Add Equality Comparison for AttributeSet

Exposes an equality comparison method (==) for comparing ActiveRecord::AttributeSet objects to each other.

Improved

Persist Format in Mailer Previews

Have you ever changed the format for a mailer preview, made a code change, and reloaded the preview only to have the desired format change back to the default? How annoying! This change utilizes JavaScript’s history.pushState to persist your desired format across refreshes. Nifty!

Performance Improvement for Active Record preload

This patch conditionally skips an expensive method call unless it’s explicitly required when calling preload on an ActiveRecord::Relation. The net benefit is an overall reduction in allocated objects and ~40% increase in speed.

Support Arrays in Active Job’s assert_enqueued_jobs

This brings Active Job’s assert_enqueued_jobs into parity with assert_performed_jobs. Specifically, the :only option now accepts Arrays.

Fixed

Fix Mounted Engine Route Regression

A regression in 4.2.3 would cause the relative_url_root and script_name to each be included in routes for mounted Engines (the expected behavior is for one, not both to be used). This patch resolves that issue on master and 4-2-stable.

Fix Test Helper Casting for Active Job

Fixes an issue where the at: argument wouldn’t be cast properly for assert_enqueued_with and assert_performed_with, causing tests to fail.

Removed

Remove pk_and_sequence_for for MySQL Adapters

pk_and_sequence_for is not used by MySQL adapters and is being removed. There won’t be a deprecation cycle for this change, so note that your implementation may break if you’re overriding this method anywhere.

Wrapping Up

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.

Until next time!

This week in Rails: Job Priorities, Fast Failing Tests and Fixtures... Oh My!

Hello everyone! This is Greg with help from Andy (welcome!) bringing you the latest news from Rails.

This weeks Rails contributors

33 people contributed to Rails this week, including 3 first-time contributors! If you are interested in becoming a contributor, have look on the issues list.

New Stuff

Add job priorities to ActiveJob

This commit allows you to set the priority for your jobs with Active Job, if your backend supports this. For more details head over to the pull request.

Fail fast reporting in test runner

If you call your test suite with --fail-fast it will abort the test run on the first failure.

Allow fixtures files to set the model class in the file itself

From now on you can set the model class in your fixture files, but set_fixture_class on your model will override it.

Fixed

Handle nested fields_for by adding indexes to record_name

This commit adds indexes to the inputs in the inner blocks of a nested fields_for, so Rails won’t raise an exception on the submission of the form.

Add a hidden field on the collection_radio_buttons

This commit fixes an issue with strong_parameters if you have a single collection_radio_button on your form and the form is submitted with no selection.

Fix parameter sanitization for query methods

With this commit the Action Controller parameters are sanitized before being passed to the Active Record query methods.

Wrapping Up

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.

Until next time!

This week in Rails: GSoC, performance improvements and bug fixes!

Hello everyone! This is Marcel with help from Andy (welcome!) bringing news from yet another week of Rails.

Google Summer of Code 2015

The fourth year of participation in Google Summer of Code 2015 is over with excellent work done in the areas of Asset Pipeline (performance and… source maps!), Web Console (browser extension), the Rails test suite (Regression Test Selection), development setup (evented file system monitoring) and internals refactoring (cookies). Special thanks to Google, mentors and students who made this all possible.

This weeks Rails contributors

46 people contributed to Rails this week, including 7 first-time contributors! If you are interested in becoming a contributor, you can have a look at the issues list.

New Stuff

Introduce Active Record ignored_columns

A use case for this would be ignoring columns that are transient. This may happen when using online schema change tools like lhm or pt-online-schema-change.

Foreign keys are now supported in create_table DSL

Not only is it more convenient to pass in the foreign_key as an option to the references method of the create_table DSL, it generates slightly more efficient SQL.

Improved

Improve the performance of Active Record save and friends

By taking advantage of internal code improvements (the MutationTracker object), Active Record’s save and similar methods have received a noteworthy performance improvement.

Change assert_difference to return the result of the yielded block

With this we can perform new assertions on the returned value without assigning it to an outer variable or otherwise wrapping subsequent assertions inside the assert_difference block.

Fixed

Fix arguments of AR::Calculations#sum

The arguments and behavior of #sum are now consistent with the other aggregate methods (count, average, minimum, and maximum) defined in ActiveRecord::Calculations.

Fix silent failure when MySQL is not running

Nothing is more frustrating than a silent failure. This fix handles an error when rake db:structure:load is run and MySQL is not installed. Previously there were no output.

Active Record: Use database precision when assigning a value to a timestamp attribute

Timestamp columns can have less precision than Ruby timestamps. This affects how a fraction of a second can be stored in the database. To fix this, the precision of the column was used when assigning a value to the timestamp attribute.

Fix ignored usages of unscoped when preloading Active Record models

Preloading an association that is using unscoped was dropping the unscoped part.

Wrapping Up

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.

Until next time!

Google Summer of Code 2015: Wrapping Up

This year marked our fourth participation in Google’s Summer of Code (GSoC). In this post we’d like to tell you a bit about this year’s projects:

Asset Source Maps (Andrei Istratii)

Andrei has added support for several types of Source Maps to Sprockets 4. With Source Maps users can see a readable version of their code inside Developer Tools (Javascript, CSS, etc.) after it’s been minified or compiled. Check out Andrei’s sprockets and sass-rails contributions to find out more about the project status.

Test Failure Prediction (Genki Sugimoto)

Inspired by Aaron Patterson’s ideas on testing, Genki Sugimoto created a testing library called ttnt. It tells you which tests are relevant to a particular commit inside your application, giving you the option of skipping full test-suite runs.

Web Console (Hiroyuki Sano)

The Rails Web Console helps Rails developers debug running applications inside the browser. This project was created in 2013 by Genadi Samokovarov as part of that year’s GSoC. In 2015 Hiroyuki Sano improved it by creating a browser extension so you can use the console inside the Developer Tools.

Performance Enhancements for the Asset Pipeline (Martha De Luque)

Martha focused on finding and addressing performance issues inside our asset generation pipeline. With her work we now have support for faster asset compilation libraries, and thanks to her benchmarks we now know where to focus future optimization efforts.

Evented File System Monitoring (Puneet Agarwal)

Rails monitors application files when running in development mode, if any change is detected the application code is reloaded on the next request. Currently Rails walks the application tree to detect said changes, Puneet’s contribution implements an alternative using native operating system events.

Siddharth worked on laying the infrastructure for a more robust implementation of cookies in Rails. Some of his changes include support for JSON Web Encryption (JWE) and JSON Web Signatures (JWS). With these changes in place we can add cool features like cookie purposes and coherent expiration.

Wrapping Up

We want to thank all the students and mentors involved in this year’s Summer of Code, we hope it was a good experience for everyone. We also want to thank Google for supporting the projects, and José Valim, Pat Shaughnessy and O’Reilly Media for helping out with learning resources for our students.

See you next year!