Created
February 8, 2013 15:33
-
-
Save DavertMik/4739732 to your computer and use it in GitHub Desktop.
Batman.js destroying resources
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class YourApp.PostsController extends Batman.Controller | |
# other controller actions | |
index: -> | |
show: -> | |
new: -> | |
create: -> | |
update: -> | |
# not routable, an event | |
# the first parameter is passed object | |
destroy: (post, node, event)-> | |
post.destroy (err) => | |
if err | |
throw err unless err instanceof Batman.ErrorsSet | |
else | |
YourApp.flashSuccess "Removed successfully!" | |
@redirect '/emails' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<a data-event-click="controllers.postsController.destroy | withArguments post">DELETE POST</a> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment