This week in Rails
Apr 15 2017
This Week in Rails: hooks, fixtures, fetch_values, database connections and more!
Hi there! This is
with another edition of This Week in Rails. This week we're covering two weeks worth of changes, so let's dive right in.
Hooks for `action_controller_base` and `action_controller_api`
This change breaks out two Action Controller hooks, where there was one before. `action_controller_base` and `action_controller_api`. These can be used to load less code at boot time.
Fixture accessor with no arguments
Do you need to load all the fixtures of a particular type? Calling a fixture accessor method with no arguments returns all fixtures.
Implement `fetch_values` for `HashWithIndifferentAccess`
Add `fetch_values` for `HashWithIndifferentAccess` in Rails, added to Ruby in 2.3.0. Support was added conditionally by using `method_defined?`.
Clear active connections after initialization
If your app uses a lot of database connections, this one is worth a look. The author said that after deploying this change, they reduced their peak open database connection count by 13%.
Fix mistake in JS response parser
This change restores the ability to accept ecmascript for parsing. The author also declares that the JS response should not modify the DOM. Take a look!
Doc improvement for `before_destroy`
Did you know that `before_destroy` hooks should be set *before* `dependent: destroy` for it to work correctly? This documents that.
Don't freeze input strings
Check this out if you're curious about changes around frozen strings and usages of Immutable String (Matz said "All String literals are immutable (frozen) on Ruby 3").
Whew! That covers just some of the changes in the first couple of weeks of April. Many other great
are available to browse, from
including 5 first-timers. Nice work!
Until next week!
Godfrey Chan · #303 - 210 Carrall St · Vancouver V6B 2J1 · Canada
Unsubscribe from newsletter