class CommentsController < ApplicationController
before_action :set_post
def create
@comment = @post.comments.build(comment_params)
class TasksController < ApplicationController
def destroy
@task = Task.find(params[:id])
@task.destroy!
respond_to do |format|
import { Controller } from "@hotwired/stimulus"
export default class extends Controller {
static targets = ["form"]
static values = { delay: { type: Number, default: 250 } }
module ApplicationCable
class Connection < ActionCable::Connection::Base
identified_by :current_member
def connect
self.current_member = env['warden']&.user || reject_unauthorized_connection
class Comment < ApplicationRecord
belongs_to :article
belongs_to :author, class_name: "User"
validates :body, presence: true, length: { maximum: 2_000 }
class Comment < ApplicationRecord
belongs_to :post
belongs_to :author, class_name: "User"
has_rich_text :body
class DocumentsController < ApplicationController
before_action :set_document, only: :destroy
def destroy
@document.discard!
class SubscriptionsController < ApplicationController
def new
@subscription = current_account.subscriptions.new
end
def create
<turbo-stream action="set_title">
<template><%= "Inbox (#{@unread_count})" %></template>
</turbo-stream>
class NotificationsController < ApplicationController
def mark_all_read
current_member.notifications.unread.update_all(read_at: Time.current)
streams = Turbo::Streams::TagBuilder.new(view_context)
<div id="save_state" class="text-xs text-gray-500">Not saved yet</div>
<div id="image_preview">
<%= render 'images/preview', record: @profile %>
</div>