Rails.application.routes.draw do
concern :tabs do
get :profile, on: :collection
get :billing, on: :collection
get :security, on: :collection
end
class Comment < ApplicationRecord
belongs_to :post
belongs_to :author, class_name: "User"
validates :body, presence: true, length: { maximum: 5_000 }
import { Controller } from "@hotwired/stimulus"
export default class extends Controller {
static targets = ["field"]
connect() {
class WizardsController < ApplicationController
before_action :load_draft
def step_1
render_step(1)
end
<article class="post">
<h1><%= @post.title %></h1>
<%= simple_format @post.body %>
<!-- Lazy load comments when scrolled into view -->
<%= turbo_frame_tag "post_#{@post.id}_comments",
.confirm-dialog {
border: none;
border-radius: 12px;
padding: 1.5rem;
max-width: 26rem;
box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
<%= turbo_frame_tag dom_id(flag) do %>
<tr class="flag-row">
<td class="flag-name"><%= flag.name %></td>
<td class="flag-env"><%= flag.environment %></td>
<td class="flag-state">
<span class="badge badge--<%= flag.enabled? ? 'on' : 'off' %>">
class ReportsController < ApplicationController
def create
@report = current_user.reports.create!(
title: report_params[:title],
status: :pending,
progress: 0
class ApplicationController < ActionController::Base
before_action :authenticate_user!
rescue_from ActionController::InvalidAuthenticityToken do
handle_unauthenticated(reason: :csrf)
end
# Controller responding with Turbo Stream
class PostsController < ApplicationController
def create
@post = Post.new(post_params)
if @post.save
import { Controller } from "@hotwired/stimulus"
export default class extends Controller {
static targets = ["dialog", "message"]
connect() {
<%= turbo_frame_tag 'modal' %>