Using the textarea helper in Rails forms

后端 未结 2 1236
予麋鹿
予麋鹿 2021-02-19 00:33

Why does this code show an error in text area?

<%= form_for(:ad, :url => {:action => \'create\'}) do |f| %>
  <%= f.text_field(:name) %>
  <         


        
2条回答
  •  暖寄归人
    2021-02-19 01:07

    The FormHelper method is text_area, not text_area_tag.

    Use either of the following:

    <%= f.text_area(:text, size: '50x10') %>
    

    or:

    <%= text_area_tag(:ad, :text, size: '50x10') %>
    

提交回复
热议问题