我想用一些可视化编辑器改进我的页面,并找到这个关于 Mercury 编辑器的轨道广播。全部完成,但是当我按下保存时,我已经重定向到我的页面而没有任何更改。没有错误,没有警告,只是未保存的格式。有人可以帮助我吗?
一些代码:
# routes:
mount Mercury::Engine => '/'
resources :tasks do
resources :comments
member { post :mercury_update }
end
# My controller:
def mercury_update
task = Task.find(params[:id])
task.title = params[:title][:value]
task.body_task = params[:body_task][:value]
task.save!
render text: ""
end
# In views/layouts/mercury.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
});
#when using 'POST' i have alert 'Mercury was unable to save to the url'
PS Rails 3.2.8,水银导轨(0.8.0)