这是我编辑的详细信息:
我有我的控制器,
class Enr::Rds::SurvRdsapXrefsController < Enr::Controller
def index
@enr_rds_surv_rdsap_xrefs = Enr::Rds::SurvRdsapXref.paginate(page: params[:page])
end
def show
end
def new
@enr_rds_surv_rdsap_xref = Enr::Rds::SurvRdsapXref.new
end
def edit
@enr_rds_surv_rdsap_xref = Enr::Rds::SurvRdsapXref.find(params[:id])
end
def create
@enr_rds_surv_rdsap_xref = Enr::Rds::SurvRdsapXref.new(params[:enr_rds_surv_rdsap_xref])
respond_to do |format|
if @enr_rds_surv_rdsap_xref.save
format.html { redirect_to :enr_rds_surv_rdsap_xrefs, notice: "Survey link was successfully created." }
format.js
format.json { render json: @enr_rds_surv_rdsap_xref, status: :created, location: @enr_rds_surv_rdsap_xref }
else
format.html { render action: "new" }
format.js
format.json { render json: @enr_rds_surv_rdsap_xref.errors, status: :unprocessable_entity }
end
end
end
def update
end
def destroy
end
end
这是我的视图形式
<%= form_for(@enr_rds_surv_rdsap_xref, :remote => true) do |f| %>
<% if @enr_rds_surv_rdsap_xref.errors.any? %>
<div id="error_explanation">
<div class="validate">
The form contains <%= pluralize@enr_rds_surv_rdsap_xref.errors.count, "error") %>.
</div>
<ul>
<% @enr_rds_surv_rdsap_xref.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<div class="control-group">
<%= f.label :section %><br />
<%= f.text_field :section %>
</div>
<%= f.submit %>
<% end %>
当我单击索引页面创建新链接时,索引页面显示错误,例如
Enr/rds/surv_rdsap_xrefs#index 中的 NoMethodError
nil:NilClass 的未定义方法“错误”
感谢您的支持,请建议我纠正错误。我是 ROR 的新手。谢谢