Skip to content

Instantly share code, notes, and snippets.

@leastbad
Last active July 4, 2021 00:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save leastbad/de98d7ed4248ae67cccb2f17108cb5e9 to your computer and use it in GitHub Desktop.
Save leastbad/de98d7ed4248ae67cccb2f17108cb5e9 to your computer and use it in GitHub Desktop.
mrujs w/ cable-car plugin

"dependencies": { "cable_ready": "5.0.0-pre1", "mrujs": "^0.3.0-beta.25" }

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
render operations: cable_car.console_log(message: "Destroy #{params[:id]}!")
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