Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/amazon-web-services/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 3 Mercury editor无法保存更改_Ruby On Rails 3_Editor_Wysiwyg_Mercury Editor - Fatal编程技术网

Ruby on rails 3 Mercury editor无法保存更改

Ruby on rails 3 Mercury editor无法保存更改,ruby-on-rails-3,editor,wysiwyg,mercury-editor,Ruby On Rails 3,Editor,Wysiwyg,Mercury Editor,我在rails应用程序(,8fd7f73029)中使用Mercury wysiwyg编辑器,无法处理它来保存文章更改,错误为“Mercury无法保存到url”。Google console提供以下日志: ailed to load resource: the server responded with a status of 404 (Not Found) http://localhost:3000/articles/3/mercury_update Failed to load reso

我在rails应用程序(,8fd7f73029)中使用Mercury wysiwyg编辑器,无法处理它来保存文章更改,错误为“Mercury无法保存到url”。Google console提供以下日志:

ailed to load resource: the server responded with a status of 404 (Not Found)    http://localhost:3000/articles/3/mercury_update
Failed to load resource: the server responded with a status of 404 (Not Found)    http://localhost:3000/articles/3/mercury_update
Failed to load resource: the server responded with a status of 404 (Not Found)   http://localhost:3000/articles/3/mercury_update
PUT http://localhost:3000/articles/3/mercury_update 404 (Not Found) jquery-1.7.js:8158
routes.rb

mount Mercury::Engine => '/'
resources :articles do
 member { post :mercury_update }
end
<span data-mercury="full" id="page_title"><%= raw @article.title %></span>
<div data-mercury="full" id="page_body"><%= raw @article.body %></div>

<%= link_to "Edit",  "/editor" + request.path, id: "edit_link", data: {save_url:   mercury_update_article_path(@article)} %>
def mercury_update
  article = Article.find(params[:id])
  article.title = params[:content][:page_title][:value]
  article.body = params[:content][:page_body][:value]
  article.save!
  render text: ""
end
mercury.js调试后插入的代码:false

show.html.erb

mount Mercury::Engine => '/'
resources :articles do
 member { post :mercury_update }
end
<span data-mercury="full" id="page_title"><%= raw @article.title %></span>
<div data-mercury="full" id="page_body"><%= raw @article.body %></div>

<%= link_to "Edit",  "/editor" + request.path, id: "edit_link", data: {save_url:   mercury_update_article_path(@article)} %>
def mercury_update
  article = Article.find(params[:id])
  article.title = params[:content][:page_title][:value]
  article.body = params[:content][:page_body][:value]
  article.save!
  render text: ""
end
在布局文件mercury.html.erb中,我有

<script type="text/javascript">
  // Set to the url that you want to save any given page to, leave null for default    handling.
  var saveUrl = null;

  // Instantiate the PageEditor
  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
  });
</script>

//设置为要将任何给定页面保存到的url,保留null以进行默认处理。
var saveUrl=null;
//实例化页面编辑器
新Mercury.PageEditor(saveUrl{
保存样式:“表单”、“格式”或“json”(默认json)
saveMethod:null、//'PUT'或'POST'(创建与更新—默认放置)
可见:true//boolean-接口是否应开始可见
});

我尝试了所有方法,但没有任何效果

简单的打字-在布局中,我有div id=“page\u title”的条件呈现,因此有两个标记,而忘记在第二种情况下包含id=“page\u title”