<%= form_with url: autosave_draft_path,
method: :post,
local: false,
data: {
controller: "autosave",
autosave_target: "form",
class Recipe < ApplicationRecord
has_many :ingredients, inverse_of: :recipe, dependent: :destroy
accepts_nested_attributes_for :ingredients,
allow_destroy: true,
reject_if: :all_blank
<!DOCTYPE html>
<html>
<head>
<title>Contacts</title>
<%= csrf_meta_tags %>
<%= csp_meta_tag %>
<%# Append is also broadcast from the model; this response scrolls the author's view %>
<%= turbo_stream.append "messages" do %>
<%= render partial: "messages/message", locals: { message: @message } %>
<% end %>
<turbo-stream action="scroll_to" target="<%= dom_id(@message) %>" behavior="smooth" block="end">
<h1>Products</h1>
<%= link_to "New product", new_product_path, data: { turbo_frame: "modal" }, class: "btn" %>
<table id="products">
<tbody>
<nav id="main-navbar"
data-turbo-permanent
data-controller="navbar"
data-navbar-menu-open-value="false"
class="navbar">
<div class="navbar-inner">
<%= turbo_stream_from :comments %>
<section class="comments">
<h2>Discussion</h2>
<%= turbo_frame_tag "new_comment" do %>
<div class="layout" data-controller="sidebar">
<aside class="sidebar">
<%= render "shared/sidebar", active: params[:controller] %>
</aside>
<main class="content-area">
<div class="orders-layout" data-controller="drawer">
<table class="orders">
<tbody>
<% @orders.each do |order| %>
<tr>
<td><%= order.reference %></td>
class CommentsChannel < ApplicationCable::Channel
def subscribed
post = find_post
if post
stream_for post
else
import { Controller } from "@hotwired/stimulus"
export default class extends Controller {
static targets = ["checkbox", "selectAll", "count", "submit"]
static values = { selectedIds: Array }
class SignupsController < ApplicationController
def new
@user = User.new
end
def create