0
我正在嘗試從解析的json(哈希表單)生成一個表單,使用此幫助程序幫助程序的參數數量錯誤
def hash_to_form(hash, fields, legend)
fields.fields_for do |b|
concat('<fieldset><legend>', legend, '</legend>')
hash.each do |key, attr|
if hash[key].is_a? Hash
hash_to_form(hash[key], b, key)
else
concat("<div class=\"field\">")
concat(b.label(key, key))
concat(b.text_field(key, :value => attr))
concat("</div>")
end
end
end
end
但是當我嘗試調用幫助程序方法時,它會給我一個錯誤的參數個數(0表示1) 。這是沒有意義的,因爲它需要3個參數?