mirror of
https://github.com/redmine/redmine.git
synced 2026-01-18 05:22:53 +01: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:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user