aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
authorAkira Matsuda <ronnie@dio.jp>2019-08-01 16:41:26 +0900
committerAkira Matsuda <ronnie@dio.jp>2019-08-01 17:58:00 +0900
commitaf2129b4c74732c88ffce76e5c55c805cb9431f6 (patch)
treec74d8c85f81ea6b3a5e4209be247c9d83666bd4d /railties
parentdbf3e4882f9da95e34ed9086f182cf424aaac224 (diff)
downloadrails-af2129b4c74732c88ffce76e5c55c805cb9431f6.tar.gz
rails-af2129b4c74732c88ffce76e5c55c805cb9431f6.tar.bz2
rails-af2129b4c74732c88ffce76e5c55c805cb9431f6.zip
Use `try` only when we're unsure if the receiver would respond_to the method
Diffstat (limited to 'railties')
-rw-r--r--railties/test/application/current_attributes_integration_test.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/railties/test/application/current_attributes_integration_test.rb b/railties/test/application/current_attributes_integration_test.rb
index 146e96facc..f4ff5b8077 100644
--- a/railties/test/application/current_attributes_integration_test.rb
+++ b/railties/test/application/current_attributes_integration_test.rb
@@ -18,7 +18,7 @@ class CurrentAttributesIntegrationTest < ActiveSupport::TestCase
def customer=(customer)
super
- Time.zone = customer.try(:time_zone)
+ Time.zone = customer&.time_zone
end
end
RUBY
@@ -53,7 +53,7 @@ class CurrentAttributesIntegrationTest < ActiveSupport::TestCase
RUBY
app_file "app/views/customers/index.html.erb", <<-RUBY
- <%= Current.customer.try(:name) || 'noone' %>,<%= Time.zone.name %>
+ <%= Current.customer&.name || 'noone' %>,<%= Time.zone.name %>
RUBY
require "#{app_path}/config/environment"