2011-06-13 10 views
0

레일 3.0.8 앱에서 필드를 업데이트하는 양식 텍스트 영역을 가져 오는 데 문제가 있습니다. 나는 오류가있는 곳을 좁히기 위해 가능한 한 많이 제거하고있다. 여기 남아있는 것이 있습니다.업데이트 작업으로 데이터를 저장하지 못합니다.

내 양식 :

<%= form_for @fb_comments, :remote => true, :html => { :'data-type' => 'html', :id => 'comment' } do |form| %> 
    <%= form.text_area :comment %> 
    <%= form.submit "Update Comments" %> 
<% end %> 

내가이 레코드 mysql을 통해 주석 컬럼에 넣어 더미 데이터 그래서 현재 데이터 형태로 제작되어 표시됩니다.

컨트롤러 :

def update 
    fbc = FbComments.find(params[:id]) 
    fbc.update_attributes(params[:comment]) 
    ... 
end 

콘솔 메시지 :

Started POST "/fb_comments/1" for 127.0.0.1 at 2011-06-13 17:31:43 -0400 
    Processing by FbCommentsController#update as HTML 
    Parameters: {"utf8"=>"✓", "authenticity_token"=>"gLA2A11uVRl/WtIR1p90aSkLoU6b8twotK+B1YNefRk=", "fb_comments"=>{"comment"=>"test test"}, "commit"=>"Update Comments", "id"=>"1"} 
    FbComments Load (0.1ms) SELECT `fb_comments`.* FROM `fb_comments` WHERE `fb_comments`.`id` = 1 LIMIT 1 
    SQL (0.1ms) BEGIN 
    SQL (0.1ms) COMMIT 
Rendered text template (0.0ms) 
Completed 200 OK in 15ms (Views: 0.6ms | ActiveRecord: 0.3ms) 

감사합니다.

답변

1

컨트롤러는하지 commentfb_comments을 잡된다

fbc.update_attributes(params[:fb_comments]) 

괭이이 도움이됩니다.

+1

무엇을 할 수있는 4 가지 방법이 있습니까? – 0112

관련 문제