class AddUniqueIndexToTags < ActiveRecord::Migration[7.1]
disable_ddl_transaction!
def up
execute <<~SQL
UPDATE tags SET name = LOWER(TRIM(name)) WHERE name IS NOT NULL;
class TurboFailureApp < Devise::FailureApp
def respond
if turbo_request?
redirect_for_turbo
else
super
class ExplainAnalyzer
def initialize(relation, watched_tables:)
@relation = relation
@watched_tables = Array(watched_tables).map(&:to_s)
end
class NotificationsController < ApplicationController
def mark_all_read
current_member.notifications.unread.update_all(read_at: Time.current)
streams = Turbo::Streams::TagBuilder.new(view_context)
Rails.application.configure do
# Bullet configuration
config.after_initialize do
Bullet.enable = true
Bullet.alert = true # Show JavaScript alert
Bullet.bullet_logger = true # Log to bullet.log
<div id="save_state" class="text-xs text-gray-500">Not saved yet</div>
<div id="image_preview">
<%= render 'images/preview', record: @profile %>
</div>
class UserRegistrationForm
include ActiveModel::Model
include ActiveModel::Attributes
attribute :email, :string
attribute :name, :string
class PostsController < ApplicationController
def new
@post = Post.new
end
def create
<%= 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
web: bin/rails server
css: bin/rails tailwindcss:watch