【发布时间】:2012-08-29 10:42:52
【问题描述】:
我想用一些可视化编辑器改进我的页面,并找到this railcast 关于 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'
附言Rails 3.2.8,水银轨道(0.8.0)
【问题讨论】:
-
再次检查您的 TaskController 中是否有匹配的结尾。
-
我已经提出了一个bug,因为我有一个类似的设置给你,所以可能值得跟踪它,看看它可以解决你的问题。
标签: ruby-on-rails mercury-editor