0
내 개체 중 하나를 업데이트하기위한 원격 양식이 있습니다. 그러나, 업데이트 후에, Rails는 본질적으로이 양식이 전혀 원격이지 않은 것처럼 다른 페이지로 리다이렉트합니다. 내가 도대체 뭘 잘못하고있는 겁니까? 뷰에서 remote_form에도 불구하고 리디렉션 하시겠습니까?
:<td id='translation-<%= base_text.id.to_s %>' class='editable'>
<span class="translationstring"><%= @translation.content %></span>
<%= form_for @translation, :remote => true, :html => { :id => ('translation-form-for_' + base_text.id.to_s) } do |f| %>
<%= text_area(:translation, :content, :rows => 2) %><%= f.hidden_field(:base_text_id) %><%= f.hidden_field(:lang) %>
<% end %>
</td>
내가 jQuery를이 .submit를 사용하여 양식을 제출해야(). 그런 다음 컨트롤러가 수행합니다
def update
@translation = Translation.find(params[:id])
respond_to do |format|
if @translation.update_attributes(params[:translation])
format.html { redirect_to @translation, notice: 'Translation was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @translation.errors, status: :unprocessable_entity }
end
end
끝
나는 또한 내가, 온라인으로 변화를 찾을 수 없습니다 서버 측에 대안 응답 시도 :
는 조언 바랍니다.
편집 :이 내 서버가 호출에 대해 말씀입니다 : 솔루션을
Started PUT "/translations/1" for 127.0.0.1 at 2012-04-04 09:45:49 +0200
Processing by TranslationsController#update as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"WbYiaRgermr2T4wzTPX/ftBsfOB8+
pHCYmhDFJMUu9I=", "translation"=>{"content"=>"Testet Schlüssel wieder.", "base_t
ext_id"=>"1", "lang"=>"de"}, "id"=>"1"}
←[1m←[36mTranslation Load (1.0ms)←[0m ←[1mSELECT `translations`.* FROM `trans
lations` WHERE `translations`.`id` = 1 LIMIT 1←[0m
←[1m←[35m (0.0ms)←[0m BEGIN
←[1m←[36m (81.0ms)←[0m ←[1mUPDATE `translations` SET `content` = 'Testet Schl
üssel wieder.', `updated_at` = '2012-04-04 07:45:49' WHERE `translations`.`id` =
1←[0m
←[1m←[35m (38.0ms)←[0m COMMIT
Redirected to http://localhost:3000/translations/1
Completed 302 Found in 133ms (ActiveRecord: 120.0ms)
나는 rails.js afaik가없는 표준 레일 3.2를 사용하고 있습니다. 그러나 jquery가 필요합니다 // jquery_ujs가 필요합니다 // require_tree – Sprachprofi
서버 물건을 추가했습니다. 제발 좀보세요. – Sprachprofi