aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/lib
diff options
context:
space:
mode:
authorMiklos Fazekas <mfazekas@szemafor.com>2015-02-06 22:44:48 +0100
committerMiklos Fazekas <mfazekas@szemafor.com>2015-02-06 22:44:48 +0100
commitbe0875f4580749c2c5ad84086f2e890ddeba7de8 (patch)
tree29f5023dd29b18b0941fcbc9b9025e7e91b9b309 /actionview/lib
parent254693a39c73b6fc9ad71b47b4d652e8738bec12 (diff)
downloadrails-be0875f4580749c2c5ad84086f2e890ddeba7de8.tar.gz
rails-be0875f4580749c2c5ad84086f2e890ddeba7de8.tar.bz2
rails-be0875f4580749c2c5ad84086f2e890ddeba7de8.zip
Fixed undefined method `i18n_key' for nil:NilClass for labels in non AR form_for
Refactoring at #18647 broke using non active record objects in form_for. This patch restores the original behaviour where we only compute i18 key when object.respond_to?(:to_model)
Diffstat (limited to 'actionview/lib')
-rw-r--r--actionview/lib/action_view/helpers/tags/translator.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/actionview/lib/action_view/helpers/tags/translator.rb b/actionview/lib/action_view/helpers/tags/translator.rb
index 829679851c..e70fe024e8 100644
--- a/actionview/lib/action_view/helpers/tags/translator.rb
+++ b/actionview/lib/action_view/helpers/tags/translator.rb
@@ -6,7 +6,7 @@ module ActionView
@object_name = object_name.gsub(/\[(.*)_attributes\]\[\d+\]/, '.\1')
@method_and_value = method_and_value
@scope = scope
- @model = object.respond_to?(:to_model) ? object.to_model : object
+ @model = object.respond_to?(:to_model) ? object.to_model : nil
end
def translate