8
我想用一些可視化編輯器改進我的頁面,並找到有關Mercury編輯器的railcast。所有完成的,但是當我按SAVE時,我已經重定向到我的頁面,沒有任何改變。沒有錯誤,沒有警告,只是未被格式化。任何人都可以幫助我嗎?
部分代碼:
# routes:
Mercury Editor in Rails not saving changes
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'
P.S. Rails 3.2.8,水銀軌(0.8.0)
仔細檢查您的TaskController中是否有匹配的結尾。 – Dean
我已經提出了一個[bug](https://github.com/jejacks0n/mercury/issues/267),因爲我有類似的設置,所以可能值得跟蹤它看到它可以解決您的問題。 – Dean