我想将使用 html 表单从用户那里获得的一些数据添加到 ruby on rails 中的 CSV 文件中。我怎样才能做到这一点?这是我的代码
<p>
<h2>Register using form below</h2>
<p class="error"></p>
<form action="" method="post" class="scrum-form">
<p><h3>Participant information</h3></p>
<div>
<label>Full name<span class="mandatory">*</span></label>
<input type="text" name="full_name" class="full_name" />
</div>
<div>
<label>Email<span class="mandatory">*</span></label>
<input type="text" name="email" class="email" />
</div>
<div>
<label>Phone number<span class="mandatory">*</span></label>
<input type="text" name="phone" class="phone" />
</div>
<div>
<label>Organization name<span class="mandatory">*</span></label>
<input type="text" name="organization" class="organization" />
</div>
<div>
<label>Job title<span class="mandatory">*</span></label>
<input type="text" name="job" class="job" />
</div>
<div>
<label>Special diet<span class="mandatory">*</span></label>
<input type="text" name="diet" class="diet" />
</div>
<p><h3>Billing information</h3></p>
<div>
<label>Address<span class="mandatory">*</span></label>
<textarea cols="40" rows="5" name="address" name="address" class="address"></textarea>
</div>
<div>
<label>Postal code<span class="mandatory">*</span></label>
<input type="text" name="code" class="code" />
</div>
<div>
<label>City<span class="mandatory">*</span></label>
<input type="text" name="city" class="city" />
</div>
<div>
<label>Cost pool or reference<span class="mandatory">*</span></label>
<input type="text" name="cost_pool" class="cost_pool" />
</div>
<div>
<input type="button" name="register" value="Register" onclick="registration();" />
</div>
</form>
</p>
这是我的操作代码
full_name = params["full_name"]
email = params["email"]
phone = params["phone"]
organization = params["organization"]
job = params["job"]
diet = params["diet"]
address = params["address"]
code = params["code"]
city = params["city"]
cost_pool = params["cost_pool"]