"dependencies": { "cable_ready": "TBD", "mrujs": "TBD" }
-
-
Save existentialmutt/296f9745b17383c4549d286dc2d386dd to your computer and use it in GitHub Desktop.
mrujs w/ cable-car plugin
This file contains hidden or 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
import CableReady from 'cable_ready' | |
import Rails, { CableCar } from 'mrujs' | |
Rails.start({ | |
plugins: [new CableCar(CableReady)] | |
}) |
This file contains hidden or 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 href="/posts/1" data-method="delete" data-cable-car>Delete</a> |
This file contains hidden or 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 PostsController < ApplicationController | |
def destroy | |
respond_to do |format| | |
format.cable_ready do | |
render operations: cable_car.console_log(message: "Destroy #{params[:id]}!") | |
end | |
end | |
end | |
end |
This file contains hidden or 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
delete "posts/:id", to: "posts#destroy" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment