在表单提交,它告诉我,这是成功创建,但它没有显示已提交的任何数据。 该数据库是空的。 它显示“空”值与实际屏幕,在这里我应该能够编辑数据上是相同的。 下面是截图
更新:我认为问题是,它使一个GET请求,但我不知道如何解决它。 这里是我的服务器的截屏做一个GET当我点击提交
这里的设置
在results_controller.rb的指标作用,我有
def index
@results = Result.all
@blob = Sex.new //==@blob = Sex.new is the one I'm focussing on...
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @results }
end
end
在视图/结果/指数,我有如下形式
<`%= form_for(@blob) do |f| %>`
<div class="field">
<b>1. solicitor exam was fixed?:</b><br/>
<%= f.label(:solicitorcurve, "it was cooked") %>
<%= f.radio_button(:solicitorcurve, "t") %> </br>
</div>
<div class="field">
<%= f.label(:solicitorcurve, "no it was ok") %>
<%= f.radio_button(:solicitorcurve, "f") %>
</div>
<div class="field">
<%= f.label(:draftingteach, "i give the teaching a grade of _ on a scale of 1 to 6") %>
<%= f.select:draftingteach, 1..6 %> </br>
</div>
在sexes_controller.rb的创造作用,我有
def create
@sex = Sex.new(params[:blob])
respond_to do |format|
if @sex.save
format.html { redirect_to(@sex, :notice => 'Sex was successfully created.') }
format.xml { render :xml => @sex, :status => :created, :location => @sex }
else
format.html { render :action => "new" }
format.xml { render :xml => @sex.errors, :status => :unprocessable_entity }
end
end
end
在模型/ sex.rb,有什么...
class Sex < ActiveRecord::Base
end
这是数据库的建立