Skip to content

Instantly share code, notes, and snippets.

View krsyoung's full-sized avatar

Christopher Young krsyoung

View GitHub Profile
<!-- replace all turbo frames with a class of "notifications" -->
<%= turbo_stream.replace_all "div.notifications" do %>
<%= render(Notification::BadgeComponent.new(notifications: current_user.notifications)) %>
<% end %>
<!-- replace the turbo frame with id="notifications" -->
<%= turbo_stream.replace :notifications do %>
<%= render(Notification::BadgeComponent.new(notifications: current_user.notifications)) %>
<% end %>
@krsyoung
krsyoung / audited.rake
Last active December 3, 2021 17:50
Helper tasks for migrating Ruby on Rails audited gem from YAML to JSONB
require 'benchmark'
# This file includes several tasks to help with the management of the audited gem. The two main tasks are:
#
# yaml_to_jsonb - this will migrate yaml data stored in a column named audited_changes_yaml to jsonb data stored
# in a column named audited_changes.
#
# scrub - this will look at all of the columns that have been excluded from audited classes and ensure that
# they are all removed from the jsonb data.
#
@krsyoung
krsyoung / README.sh
Last active December 19, 2024 17:45 — forked from kimadactyl/README.sh
Dokku / Digital Ocean / Rails / Postgres / Let's Encrypt / persistent storage
# Creating a Digital Ocean droplet running Rails + Postgres with persistant storage and https
#--------------------------------------------------------------------------------------------
# For your ctrl-D pleasure...
# SERVER_IP
# APP_NAME
# RAILS_SECRET (generate with `rails secret`)
# ADMIN_EMAIL