0

我想转义这个表单的输入,这样当它进入数据库时​​,像 .'* 这样的字符不会影响更新。我将如何对字符进行编码以实现上述目标。

<% form_for @post, :url => {:action => :createInnovation } do |form| %> 
  <fieldset>
    <p> Title: <br/><%= form.text_field :title, :html => {:class => "text ui-widget_content ui-corner-all" } %> </p>
    <p> Description: <br/> <%= form.text_area :body, :html => {:class => "text ui-widget_content ui-corner-all" } %> </p>
  </fieldset>
<%end%>
4

1 回答 1

4

ActiveRecord 将根据需要自动转义任何字符以防止 sql 注入。这就是你所关心的吗?如果是这样,Rails 可以满足您的需求。

于 2009-07-24T19:47:12.367 回答