In rails, whether to use form helpers or not to?

前端 未结 5 981
天命终不由人
天命终不由人 2021-01-05 12:18

In rails, is it recommended to use form helpers? Internally, everything boils down to plain html then why not write the html directly? Performance will obviously be better i

5条回答
  •  时光取名叫无心
    2021-01-05 12:57

    Its seems good when a developer having same name for class,id and no value for a input field if he needs different name id and also giving value then he have to write <%= text_field_tag " name", :value=>"value", :id=>"id" ,:class=>""class %> and for same html can be < input type ="text" value ="value" class="class" name ="name" id="id"/> now think overhead 1. evaluate first helper into html 2. now also consider length of that in helper we also have to write : , => 3. sometimes you forget to use : or , by mistake so i think we prefer html in that case And one thing if your server getting lots of request than it will got too busy and the response time will be increased because <%= %> should have to execute

提交回复
热议问题