xaviershay / enki

A Ruby on Rails blogging app for the fashionable developer. It's better than Mephisto or SimpleLog

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot delete post in admin

ryanprayogo opened this issue · comments

Deleting post in admin (clicking the red '-' button) doesn't delete the post and the following error message is displayed:

Could not delete item, or maybe it has already been deleted

Afterwards, if I refresh the page, I am forced to re-login to admin and the post still exist.

odd, I'll look into it

Hey guys, I ran into that same problem.
I digged a little bit around and found out that deleting a post is using a AJAX call to the PostController. This works fine. But it seems that there is no information about the already existing session. So what does happen is: the controller redirects us to the session#new action which can't handle JSON formats so we get an error saying there is no JSON view for this action.

I hope this helps.
Ömer

ah of course, the 3.0.4 upgrade would have broken this. We need to add this code:

http://weblog.rubyonrails.org/assets/2011/2/8/jquery-snippet.js

Send csrf-token with AJAX requests now that rails doesn't make an exception for XHR in 3.0.4.

Closed by 9a482af.