Railscastチュートリアルに従って、mercury エディターをセットアップしました。
mercuy.js
$(window).bind('mercury:ready', function() {
var link = $('#mercury_iframe').contents().find('#edit_link');
Mercury.saveUrl = link.data('save_url');
link.hide();
});
$(window).bind('mercury:saved', function() {
window.location = window.location.href.replace(/\/editor\//i, '/');
});
ビュー/引用/show.html.erb
<p><%= link_to "Edit Page", "/editor" + request.path, id: "edit_link", data: {save_url: mercury_update_quotation_path(@quotation)} %></p>
水銀.html.erb
new Mercury.PageEditor(saveUrl, {
saveStyle: 'form', // 'form', or 'json' (default json)
saveMethod: null, // 'PUT', or 'POST', (create, vs. update -- default PUT)
visible: true // boolean - if the interface should start visible or not
});
ルート.rb
resources :quotations do
member { post :mercury_update}
end
次のエラーが表示されます
Mercury was unable to save to the url: http://localhost:3000/quotations/1
コンソール出力
Started PUT "/quotations/1" for 127.0.0.1 at 2015-03-07 19:20:49 +0530
AbstractController::ActionNotFound (The action 'update' could not be found for QuotationsController):
静的IDではうまく機能しましたが、これは好きではありませんでした。このエラーを解決するのを手伝ってください。