1
0
mirror of https://github.com/meineerde/redmine.git synced 2025-12-29 19:59:38 +00:00

NoMethodError: undefined method `id' error on EnumerationFormat#value_from_keyword (#22911).

Patch by Haihan Ji.

git-svn-id: http://svn.redmine.org/redmine/trunk@15429 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2016-05-28 11:37:28 +00:00
parent 95bf7fbc37
commit fad71f8b4b
2 changed files with 5 additions and 1 deletions

View File

@ -715,7 +715,7 @@ module Redmine
end
def value_from_keyword(custom_field, keyword, object)
value = custom_field.enumerations.where("LOWER(name) LIKE LOWER(?)", keyword)
value = custom_field.enumerations.where("LOWER(name) LIKE LOWER(?)", keyword).first
value ? value.id : nil
end
end

View File

@ -84,4 +84,8 @@ class Redmine::EnumerationFieldFormatTest < ActionView::TestCase
end
end
end
def test_value_from_keyword_should_return_enumeration_id
assert_equal @foo.id, @field.value_from_keyword('foo', nil)
end
end