Skip to content

Instantly share code, notes, and snippets.

@existentialmutt
Forked from leastbad/README.md
Last active July 4, 2021 00:35
Embed
What would you like to do?
mrujs w/ cable-car plugin

"dependencies": { "cable_ready": "TBD", "mrujs": "TBD" }

import CableReady from 'cable_ready'
import Rails, { CableCar } from 'mrujs'
Rails.start({
plugins: [new CableCar(CableReady)]
})
<a href="/posts/1" data-method="delete" data-cable-car>Delete</a>
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
delete "posts/:id", to: "posts#destroy"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment