이벤트 레코드에 대해 새 EventPlace를 만들려고합니다. 나는 이벤트 accepts_nested_attributes_for을 설정 한 : event_places 내보기에 다음 코드를 :fields_ 필터 체인 중지 오류 발생
<div id="add_venue_form" style="border:2px solid black; padding: 5px;">
<% form_for @event, :html => {:name => "form2"} do |f| -%>
<% f.fields_for @event_place do |v| -%>
<%= v.text_field :place_id %>
<% end -%>
<a class="button" style="margin-left:10px;margin-top:4px;" href="javascript:document.form2.submit();" onclick="this.blur();"><span>Save</span></a>
<% end -%>
나는 필드에 ID 번호를 추가하고 저장 버튼을 클릭
, 그것은 나에게 오류를 제공합니다
params 객체를 파라미터는 고전처럼Processing EventController#update (for 127.0.0.1 at 2012-05-24 15:43:39) [PUT]
Parameters: {"id"=>"48404", "action"=>"update", "controller"=>"event",
"_method"=>"put", "event"=>{"event_place"=>{"place_id"=>"3"}}}
SQL (0.1ms) SET NAMES UTF8
Redirected to http://localhost:3001/event/list
Filter chain halted as [#<Proc:[email protected]/Users/anthonylassiter/.rbenv/versions/ree-1.8.7 2012.02/lib/ruby/gems/1.8/gems/actionpack-2.3.10/lib/action_controller/verification.rb:82>] rendered_or_redirected.
Completed in 8ms (DB: 0) | 302 Found [http://localhost/events/48404]
내 업데이트 방법은
def update
@event = Event.find(params[:id])
if @event.update_attributes(params[:event])
redirect_to index
end
end
같습니다 rect. 내 event_controller에서 내 업데이트 메소드를 치는 것조차 보이지 않는 대신 내부 오류가 발생하고/list에 존재하지 않는 리디렉션을 시도하지만 Update가 작동하는 경우에는 필요하지 않습니다.
그게 전부였습니다! 고맙습니다. 이것은 다른 사람의 코드이므로 그들이 한 일을 발견하고 있습니다. 그것은 확인 중이었습니다 : 게시물, 그리고 내가 사용하고있는 : 레코드를 업데이 트하다. 다시 한번 감사드립니다. – alassiter