私は現在4つのtext_fieldsを持っているフォームを持っていますが、実際にはフォームの下にあるものだけが実際にモデルにデータを追加しますか?すべてのtext_fieldsは同一で、私の人生のために、なぜ彼らはすべて同じように動作しないのか理解できません。うまくいけば私のコードは誰かが簡単な答えを持っていますか?Form_forヘルパー - Rails
class ResponsesController < ApplicationController
def new
@response = Response.new
end
def create
@response = Response.new(response_params)
if @response.save
flash[:notice] = "Response has been edited"
redirect_to new_response_path(:response)
else
render "new"
end
end
private
def response_params
params.require(:response).permit(:message)
end
あなたが他を使用している場合、これは、あなたは下のテキストフィールドに入力した場合は、メッセージへの入力データを実際になります私の見解
<div class="container">
<div class="row">
<h3 class="text-center">Edit The Bounce Back Response</h3>
<div class="col-lg-8 col-lg-offset-2 well">
<%= form_for @response do |form| %>
<div class="form-group">
<%= form.label :message, "Visitor:", class: "response_label"%>
<%= form.text_field :message, class: "form-control", placeholder: "Change Visitor Response!" %>
</div>
<div class="form-group">
<%= form.label :message, "Staff:", class: "response_label"%>
<%= form.text_field :message, class: "form-control", placeholder: "Change Staff Response!" %>
</div>
<div class="form-group">
<%= form.label :message, "Volunteeer:", class: "response_label"%>
<%= form.text_field :message, class: "form-control", placeholder: "Change Volunteer Response!" %>
</div>
<div class="form-group">
<%= form.label :message, "Dance:", class: "response_label"%>
<%= form.text_field :message, class: "form-control", placeholder: "Change Dance Response!" %>
</div>
<%= form.submit "Update", class: "btn btn-primary" %>
<% end %>
</div>
ですテキストフィールド私のコンソールリターンはこれです
uがあなたの 'responses_controller.rb'ファイルを投稿することができますか? – 7urkm3n
あなたの '編集と更新'メソッドはどこですか?あなたのform_forは '_form.html.erb'にありますか? – 7urkm3n
私はまだそこにいません、私はちょうど彼らがモデルを入力するtext_field – Bitwise