This monkey patch is even if the SelectList is not multiple, we can clear selectitems by select_none(original code was set first.value when select_none).
class Mechanize::Form::SelectList < Mechanize::Form::MultiSelectList
def value
value = super
if value.length > 0
value.last
elsif @options.length > 0
# @options.first.value
nil
else
nil
end
end
end
0 件のコメント:
コメントを投稿