class Comment < ApplicationRecord
belongs_to :account
belongs_to :author, class_name: "User"
validates :body, presence: true
class ProductsController < ApplicationController
PER_PAGE = 24
def index
@page = [params[:page].to_i, 1].max
@sort = %w[name price recent].include?(params[:sort]) ? params[:sort] : "recent"
class Board < ApplicationRecord
has_many :cards, dependent: :destroy
belongs_to :owner, class_name: "User"
validates :name, presence: true
end
<%= turbo_frame_tag dom_id(contact) do %>
<tr class="contact-row">
<td><%= contact.name %></td>
<td><%= contact.email %></td>
<td><%= contact.role.titleize %></td>
<td class="actions">
module ApplicationCable
class Connection < ActionCable::Connection::Base
identified_by :current_user
def connect
self.current_user = find_verified_user
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 }
<div class="layout" data-controller="viewport">
<%= turbo_frame_tag "master", class: "master-pane" do %>
<h1>Products</h1>
<ul class="product-list">
<% @products.each do |product| %>
<li>
import { Controller } from "@hotwired/stimulus"
export default class extends Controller {
static targets = ["dialog", "message"]
connect() {
<h1>Create your account</h1>
<%= render "error_summary", record: @user %>
<%= form_with model: @user, url: signups_path do |f| %>
<div class="field">
<div class="dashboard">
<header class="dashboard__header">
<h1>Overview</h1>
<p class="muted">Real-time metrics update as they load.</p>
</header>
class ArticlesController < ApplicationController
before_action :set_article, only: %i[edit update]
def new
@article = Article.new
end