File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ module Translation
15
15
# to translate many keys within the same controller / action and gives you a
16
16
# simple framework for scoping them consistently.
17
17
def translate ( key , **options )
18
- if key . start_with? ( "." )
18
+ if key & .start_with? ( "." )
19
19
path = controller_path . tr ( "/" , "." )
20
20
defaults = [ :"#{ path } #{ key } " ]
21
21
defaults << options [ :default ] if options [ :default ]
Original file line number Diff line number Diff line change @@ -65,6 +65,11 @@ def test_lazy_lookup
65
65
end
66
66
end
67
67
68
+ def test_nil_key_lookup
69
+ default = "foo"
70
+ assert_equal default , @controller . t ( nil , default : default )
71
+ end
72
+
68
73
def test_lazy_lookup_with_symbol
69
74
@controller . stub :action_name , :index do
70
75
assert_equal "bar" , @controller . t ( :'.foo' )
You can’t perform that action at this time.
0 commit comments