Ruby on rails 添加文本区域字段以设计编辑表单

Ruby on rails 添加文本区域字段以设计编辑表单,ruby-on-rails,forms,devise,textarea,Ruby On Rails,Forms,Devise,Textarea,我有一个叫做折扣信息的属性。我想在设计编辑表单中创建另一个字段,以便用户可以编辑此信息。我希望该字段是一个文本区域。我不知道如何在rails中实现这一点 <h2>Edit <%= resource_name.to_s.humanize %></h2> <%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put

我有一个叫做折扣信息的属性。我想在设计编辑表单中创建另一个字段,以便用户可以编辑此信息。我希望该字段是一个文本区域。我不知道如何在rails中实现这一点

<h2>Edit <%= resource_name.to_s.humanize %></h2>

<%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %>
  <%= devise_error_messages! %>

  <div class="field">
    <%= f.label :email %><br />
    <%= f.email_field :email, autofocus: true %>
  </div>
  <div class="field">
    <%= f.label :address %><br />
    <%= f.email_field :address, autofocus: true %>
  </div>
  <% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
    <div>Currently waiting confirmation for: <%= resource.unconfirmed_email %></div>
  <% end %>

  <div class="field">
    <%= f.label :password %> <i>(leave blank if you don't want to change it)</i><br />
    <%= f.password_field :password, autocomplete: "off" %>
  </div>

  <div class="field">
    <%= f.label :password_confirmation %><br />
    <%= f.password_field :password_confirmation, autocomplete: "off" %>
  </div>

  <div class="field">
    <%= f.label :current_password %> <i>(we need your current password to confirm your changes)</i><br />
    <%= f.password_field :current_password, autocomplete: "off" %>
  </div>

  <div class="actions">
    <%= f.submit "Update" %>
  </div>
<% end %>
编辑


目前正在等待确认: (如果不想更改,请留空)

(我们需要您当前的密码来确认您的更改)
,:占位符=>“如果需要占位符”%>

只需在
表单中添加属性,并在
配置允许的参数方法中添加允许的属性

<div class="field">
  <%= f.label :discount_info %><br />
  <%= f.text_area :discount_info %>
</div>
<div class="field">
  <%= f.label :discount_info %><br />
  <%= f.text_area :discount_info %>
</div>
def configure_permitted_parameters
  #other code
  devise_parameter_sanitizer.for(:account_update) { |u| u.permit(:other_attributes, :discount_info) }
end