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!

This week in Rails: Connection Pool, Responsive Site, Oh my!

Hey everyone, cough this is cough Kasper.

I've been cough sick most of the week and am cough-ing my way through this.

Feel free to insert cough's through the rest of this, as long as you remember not to snooze on a sneeze or two too.

Alright, cough 'em up.

Featured

This Week's Rails Contributors

Look at these 31 people and how they've hammered away at their keyboards, as if possessed by a different sickness. One of radness that is, my duderinos and duderinas.

Active Record: Connection Pool is More Concurrent

Active Record keeps a pool of database connections. To keep the pool safe from people trying to cannonball queries at once we need to lock it. The pull request slims down what happens when locking, so you can quicker release the lock. Basically more people can go splash, because the diving board is free earlier.

Holy Ruby on Rails on Responsive Website, Batman!

Are you on your phone? Are you on your watch? Are you on the toi... eh, anyway, the Rails website is now responsive.

Just to tide you over until the website redesign will be revealed. That'll surely be a royal flush.

New Stuff

The Tragoedia and Comoedia of Integers

This week integers gained introspection methods that makes a select a tad easier to read. They are the gangbuster team of negative? and positive?. And hopefully the polarity shockwaves will rock the Ruby world too.

Fixed

Don't Add to Local Assigns without an Object

If you rendered a partial like <%= render partial: 'spruce_goose' %>, Rails would spruce up local_assigns with the name of the partial. That goose chase ended this week.

One More Thing™

One More Chance to Review Rails API

The option to generate API only Rails apps is almost done. But there's still a chance to help out by reviewing it. Give it a shot of love!

That's a wrap

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!

This week in Rails: Job IDs, inline images preview and more

Hi there!! Washington here again.

Glad we all made to another Friday. A lot of small patches around Rails repository this week. So we had another relatively calm week after the major announcements on RailsConf. The talks list is getting bigger on confreaks by the way. You might want to watch some of those this weekend.

Featured

This Week's Contributors

38 people made it to the Rails repository this week. Check out the pulse page on github too for the full list of recent issues and PRs.

New Stuff

Keeping original job IDs with ActiveJob#provider_job_id

ActiveJob will be able to report the original adapter job ID in Rails 5. The patch started targeting Delayed Job then Sidekiq and Que got their own about a week later. Great team work.

Mailer previews support inline images

This commit adds a preview interceptor to search for inline cid: urls in src attributes and convert them to data urls. P.S. I had to look up the cid protocol myself to get this one.

Deprecated

Removed assigns from functional test templates

Rails is moving towards deprecating the assigns helper on controller tests. The main motivation is that it's asserting against the internals of the implementation which we shouldn't care about in a unit test.

See some comments from DHH about that and a couple other test helpers.

Improved

Allow custom response messages on authentication methods

This adds the same functionality already provided in Digest to the HTTPAuth Basic and Token modules.

Apply schema cache dump when creating connections

Quite interesting patch on improving the set up for database connection pools. The schema cache dump will now be applied to every connection as they are created to avoid querying the database for its schema.

That's a wrap

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!

This week in Rails: recovering from RailsConf

Happy Friday! It’s Claudio with the latest updates on Rails. Overall, this has been a relaxed week. Many documentation fixes have made their way into master while features uncovered at RailsConf (like the integration of Rails API) are being heavily discussed on GitHub.

Featured

This Week's Contributors

This week 31 people helped Rails out. Six people had their first commit merged into rails/rails. Hooray!

RailsConf 2015 videos

One by one, all the presentations of RailsConf are being uploaded. Lots of great talks to fill your weekend!

GSoC students announced!

We are proud to announce that 8 students will be working on improving Rails as part of the Google Summer of Code 2015. Congratulations and welcome to Rails!

Improved

Better docs for minitest assertions

Rails ships with minitest by default but has different naming conventions for inverse assertion methods. The new guides clarify this difference. And give us a great excuse to link to Ruby on Rails on Minitest.

Toward a better "Caching with Rails" guide

Everyone can help make Rails better by improving its guides. "Caching with Rails" is an awesome place to start. If you think you can improve it, don’t hesitate to submit a pull request!

Remove use of mocha in the named-base tests

Some tests in the Rails codebase use the mocha library and can be faster by using minitest/mock instead. This commit fixes one of those tests; you are all invited to do the same for the remaining ones.

Fixed

Rake routes not showing right format when nested

The rake routes command was not properly showing nested routes with a scope constraint for the format override by a resource… but that just got fixed!

That's a wrap

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!

Welcome to Google Summer of Code 2015!

Google has announced the list of accepted projects for this year's Google Summer of Code(GSoC). Rails has been granted 8 slots, here's a brief introduction to the projects and the people behind them.

Performance Enhancements for the Asset Pipeline

Student: Martha de Luque
Mentors: Guillermo Iguaran and Josh Peek

Martha will be profiling, benchmarking and updating parts of our asset compilation process to improve our asset [re]generation speed. The initial scope of this project covers CoffeeScript, Sass and our Uglifier, but benchmarks will be guiding this effort to work where we can get the biggest benefits in these four months.

Evented File System Monitoring

Student: Puneet Agarwal
Mentors: Xavier Noria and Matthew Draper

ActiveSupport::FileUpdateChecker, the system we use for detecting changes in files (mostly for reloading purposes) has served us well over the years, but we're done with polling. Puneet will be replacing our current design with a event-based approach that relies on existing third-party monitors (e.g. inotify or FSEvent).

Asset Pipeline Support for Source Maps

Student: Andrei Istratii
Mentors: Rafael França and Arthur Nogueira Neves

The goal of Andrei's project is to give you good inspecting and debugging capabilities in environments where your code goes through various transformations (e.g. your CoffeeScript file being compiled to Javascript and then minified in your staging environment). With source maps you can use the existing tools your browser provides to do things like reading the CoffeeScript source or setting breakpoints on it.

Refactoring Action View and Active Support

Student: Islam Wazery
Mentors: Kir Shatrov and Carlos Antonio da Silva

Islam is adding some of the things we should already have in Rails, liked adding named arguments for Action View helpers (goodbye counting commas!). He will also be researching how to improve some of our core abstractions like ActionController::Parameters and ActionView::OutputBuffer to enable better security and performance.

Web Console Browser Extensions

Student: Hiroyuki Sano
Mentor: Genadi Samokovarov

Following up on the work of previous GSoC projects, Hiroyuki will be creating browser extensions for the Rails web console. Like the Source Maps project, this one will give you a better live debugging experience using standard tools that everyone has available already.

Test Failure Prediction

Student: Genki Sugimoto
Mentors: Robin Dupret and Josh Kalderimis

Aaron Patterson has touched upon some interesting ideas on predicting test failures using the experimental Coverage feature available in recent Ruby versions. Genki will be experimenting with this to see if we can make it a part of the Rails testing ecosystem.

Refactoring Cookies

Student: Siddharth Bhatore
Mentors: Kasper Timm Hansen and Prem Sichanugrist

Rails cookie handling is pretty basic, and although it works in most use cases, we can improve it. Siddarth will be adding server-side expiration mechanisms and purpose fields to our existing cookie jar, allowing us to have better control and security over our systems.

Improving RubyBench.org

Student: Kasif Gilbert
Mentors: Sam Saffron

In case you're not familiar with it, RubyBench is an amazing effort to keep long running benchmarks for Ruby and related projects (like Rails). As you can see, our own benchmarks could use some love, so Kasif will be taking care of this. If everything goes well, JRuby support in RubyBench would be the next step for this project.


Fun Fact: 4 of the 14 mentors we have this year participated as GSoC students in previous years. Today they're all active contributors around the Ruby/Rails ecosystem!

We hope to keep you up on important updates during the summer, but if you're interested in staying up to date (or maybe lending a hand?) please make sure to subscribe to our mailing list.

Finally, we want to thank José Valim/The Pragmatic Programmers, Pat Shaughnessy/No Starch Press and O'Reilly for donating copies of Crafting Rails Applications, Ruby Under the Microscope and offering discounts on O'Reilly products to our students.

PS: In case you missed it, Ruby and SciRuby will also be part of this year's GSoC! You can learn more in the Ruby GSoC and SciRuby Development mailing list announcements.

This week in Rails: RailsConf 2015 Edition

ZOMG! Hello everyone, it is Godfrey here (it's been a while!), delivering the latest news from Rails to your inbox. This happens to be RailsConf week, so we have lots to cover; lets get to it!

Note: The links to the RailsConf videos are the unedited live-stream versions, and they might be removed later. Also, only talks from the keynote room are available at the moment, but don't worry – the full set of talks will eventually be made available to everyone. Follow @railsconf to stay in the loop!

Rails Conf 2015

Day 1: DHH keynote, Sara Chipps keynote

David Heinemeier Hansson kicked off the conference by announcing a few new features in Rails 5: Rails API, turbolinks 3, a native mobile wrapper and web sockets support (a.k.a. Action Cable).

The amazing Sara Chipps wrapped up the day by sharing her experience teaching kids to code.

Check the schedule for a full list of talks from Room 202. Shameless plug: yours truly gave a talk following the DHH keynote ;)

Day 2: Aaron Patterson keynote, lightning talks

Aaron Patterson started the second day with a punishing amount of word play jokes. In between trolling other keynote speakers and rebooting his computer, he also dropped an incredible amount of performance knowledge.

Don't forget to catch the lightning talks towards the end of the stream!

Day 3: Ruby heroes, core team panel, Kent Beck closing keynote

The Ruby heroes awards were given on the third day, followed by a panel discussion featuring some members from the Rails core team.

Kent Beck, aka the creator of XP (not to be confused with the other XP) wrapped up the conference with a focus on the human elements of programming.

Featured

This week's Rails contributors

Just because it is Rails Conf, it doesn't mean contributions to the Rails codebase will see any slow down. In fact, 37 contributors made their mark on Rails this week, with 11 first-time contributors!

Rails API

As mentioned in David's keynote, Rails API will be part of Rails 5. Follow the pull request to track the progress and chime in on the discussion. (Please avoid leaving +1 comments!)

New Stuff

Generic bug report template

Joining the existing bug report templates, this new template will be handy for reproducing small bugs with a minimal setup. Check the contributing guide for details.

[attr_name]_previously_changed?

With this patch, you can easily check if a single attribute has previously changed and react to those changes appropriately.

That's a wrap

It's been quite a week! We didn't have room to cover everything that happened in Rails, so head over and take a look for yourself.

Thank you for your continued support for the newsletter. (I am very glad to have met a few of you at RailsConf!) As always, feel free to share this with your friends. If you have any comments or would like to help, drop me a line!

This week in Rails: Ruby 2.2.2, RailsConf and more!

Hey reader, Kasper here.

I'm sole jammin' and grand slammin' words into your inbox.

But before the Rails juice, a quick story spruce: At my company we have a coworker we look up to, because she's doing a cross country trek.

She's our heroine and she just crossed the border.

Oh right, you were looking for Rails news.

Featured

This Week's Contributors

This week 42 people helped Rails out. Rails 5 comes closer everyday and it's only possible because of all your help. Keep it up and it'll be the best version of Rails yet.

prepend Primed to Dethrone alias_method_chain

Remember when we said alias_method_chain had been deprecated? Well, if the method being overriden called super, you'd be stuck in an infinite recursion - like that friend who didn't graduate kindergarten. This week prepend became the successor Rails needs. And how is that possible?

Rails 5 Requires Ruby 2.2.2

Well, I'm glad you kept reading, because Ruby 2.2.2 has a fix for prepend. The new version is mainly a security release - with some bug fixes squeezed in there - so no procrastinating the upgrade, okay? You want to be ready to hit the lab next week too.

New Stuff

Controllers With Default Form Builders

There's a new default_form_builder method you can override in controllers. Then form_for and friends will use the passed builder class to architect the view.

A new Action Pack XML Parser Release

Hey, there's a new version of this thing out.                                                  

Improved

Railties Uses Bundler's exe Convention

You've probably been prepending bin when running rake or rails like a good samaritan. Those are binstubs in action. But bin is for executables in general and not just those stubs. Not anymore, as Bundler reserves bin for binstubs and exe for executables. This week Railties executed that convention.

One More Thing™

Meet Us at RailsConf

A few of us are going to the big peach next week. So after you've seen DHH reveal the really big stuff coming in Rails 5, you can mingle with us at RailsConf. Both Godfrey and Claudio will be speaking. ...and I guess I'm there too.

That's a wrap

Another week in Rails went by - and so swiftly. There's more changes in this tailored link.

Lastly, either pluck in a few of your friends' emails here or ask Godfrey how you can get to write these things too.

This week in Rails: batch touching, default controller response and more!

Hey there, this is Washington. It's finally Friday again!!!

A lot of bug fixing and a couple great improvements going on the Rails environment this week. Read on for more details.

Featured

This week's Rails contributors

31 contributors have helped improve Rails this week. Consider taking some time next week to make a contribution to an open-source project :) (I keep telling that to myself every day)

Improved

Batch touch parent records

YAY! I bet many projects have been looking forward to this improvement. After a couple discussions and experiments touching is finally limited to the fewest possible number of queries.

Controller actions default to head :no_content if no template exists

After all these years DHH is still pushing for better defaults on Rails. Next major version will assume everything went fine if a controller action has no template. I can't see why not.

Fixed

Non-ascii characters in URLs on Windows

We are a few months into 2015, but these encoding-related problems are still haunting us! With this fix, Windows apps will stop blowing up on strange URLs. Yet another example of how awesome the Ruby and Rails community can be.

Error when defining callbacks named run

An apparently nice performance improvement has caused a regression on the callback system. Plus according to new benchmarks it seems the original performance improvement is no longer relevant.

force_ssl without session_store

config.force_ssl = true now works properly even when you have disabled the session store.

Uniqueness validations and out-of-range integers on PostgreSQL

Another patch to make Active Record API rock solid.

One More Thing™

Redcarpet 3.2.2 has an XSS vulnerability

I haven't seen much noise about this vulnerability on the interwebs but just in case. If you have this markdown parser on any of your projects you should probably bump it whenever you have a chance.

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!

This week in Rails

Happy Good Friday Everyone!

Here comes the gist of last week's interesting commits from Rails. Stay tuned!

Featured

This week's Rails contributors

We had 30 amazing contributors this week, big thanks to all them!

New Stuff

Explicit base class for Active Job jobs

It is recommended to not change settings on ActiveJob::Base directly so from now on every generated Job will inherit from ApplicationJob and you can tweak that for your needs.

Rails uses Sprockets 3 now!

Sprockets 3 will be released soon and the Rails team decided to give the release candidate a try.

Deprecated

Deprecate the :tokenizer option in validates_length_of

This option only served an extremely specific use case hence became deprecated. If you rely on this functionality, you can implement it with a plain Ruby method.

Improved

Only coerce time in comparison if necessary

In the development environment ActiveSupport::FileUpdateChecker#max_mtim triggers many time comparison and there were many unnecessary to_time calls. With this patch Rails saves around 100ms per request!

Reduce memory usage when loading types in Postgres

The PG::Result object were never cleared when the application queries the types. By clearing that object Rails use less memory.

Fixed

Return super in ActionController::Parameters.const_missing

With this pull request ActionController::Parameters.const_missing's super is always returned whereas before it was only called and its return value was mistakenly discarded.

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!

This week in Rails: Goodbye alias_method_chain, PostgreSQL typecasting and more

Hey all!

This is Prathamesh with this week's recap from Rails. Lets see which issues got fixed, which features got added. Ready, steady, go!

Featured

This week's Rails contributors

This week 40 people contributed to Rails, 7 out of them are new. Do you also want to help? Check out the issue tracker and start making Rails better.

By the way, Xavier and Kasper added the permalink feature to the link of weekly contributors. So each weekly contributors link is forever to stay!

New Stuff

Warning if the query fetches more than fixed number of records

Faced problem with queries fetching thousands of records and slowing everything? Now you will get a nice warning if the query fetches more number of records than configured value by using active_record.warn_on_records_fetched_greater_than config option.

Deprecated

Deprecate alias_method_chain in favor of Module#prepend

Do you remember the old friend alias_method_chain? It had a good run. But now it will be deprecated in Rails 5 in favor of Module#prepend which was introduced in Ruby 2.0.

Improved

Moving type casting for PostgreSQL out of Active Record

We just got two steps closer to moving type casting of various data types for PostgreSQL from Active Record to PostgreSQL adapter.

Friendlier access to request variants

With this patch, you can now check the current request's variant using request.variant.phone?, request.variant.tablet? and so on.

Fixed

Pass name of the wrapped job class to Sidekiq for logging

If you were missing your job class in the Sidekiq logs and instead seeing some weird ActiveJob::JobWrapper, don't worry. Now you will get your job class back in the logs because ActiveJob will pass the wrapped class name back to Sidekiq.

Use actual table name while joining tables with has_many :through

Previously, while joining tables having has_many :through association, Active Record was not using the actual table name. It was generating wrong SQL and resulting into ActiveRecord::InvalidStatement error when used with calculation methods like #count. No need to worry, its fixed now!

Generate fixture file with singular name for singular tables

Previously if the table name was made singular using ActiveRecord::Base.pluaralize_table_names = false, name of the fixture file getting generated was still pluralized. No longer true! Get singular fixture file for singular table name now onwards.

Summer Opportunity

Rails Girls Summer of Code

Checkout Rails Girls summer of code. You can submit your open source project to be included. Also you can help fund the campaign.

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!