Skip to content

Instantly share code, notes, and snippets.

View vmcilwain's full-sized avatar

Vell vmcilwain

View GitHub Profile
@vmcilwain
vmcilwain / paranoid_uniqueness_validator.rb
Created January 23, 2020 19:48
Custom validator to allow creation of a record with duplicate content if it has been flagged as deleted.
# Custom validator to allow for duplicate content on an attribute in a class using acts_as_paranoid gem.
#
# Scenario:
# A user can create a record with an attribute with given content 'test'
# if a previous record with that attribute/content does not exist or if it does exist but was flagged as deleted (deleted_at IS NOT NULL)
#
# Usage:
# validates :attribute, paranoid_uniqueness: true
# or
# validates :attribute, paranoid_uniqueness: { scope: platform_id, message: 'custom message }
@vmcilwain
vmcilwain / migrating from import maps to esbuild and bootstrap after implementing action text.md
Created January 12, 2023 15:12
How I migrated from import maps to esbuild and bootstrap after implementing action text

Found the following instructions that got me to the point where esbuild replaced import maps and bootstrap was installed.

https://mixandgo.com/learn/ruby-on-rails/how-to-install-bootstrap

You will find that even after fixing the Javascript issues Javascript still does not work. When looking in the log files I saw there were issues with trix loading as well as issues with importing stimulus controllers.

What I ended up doing was modifying package.json and add the following:

"@rails/actiontext": "^7.0.4",