11 ms·
Looks like some nice additions. I try to limit the use of .try in rails, however when working with legacy codebases it is much nicer then: if @user && @user.ad
by r-s 11y ago
Looks like some nice additions. I try to limit the use of .try in rails, however when working with legacy codebases it is much nicer then:
if @user && @user.address && @user.address.city
city = @user.address.city
end
Even though I write less Ruby then I once did, I still credit it as the language which shaped my career the most. I have worked so many great jobs because of Ruby.
- gkop 11y agoYup. In addition to the general purpose safe navigation operator we also have Hash#dig now which helps with those pesky nested params: params.dig(:user, :address, :city)