This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Use this validator like this | |
# | |
# class User < ApplicationRecord | |
# validates :profile_link, url: true | |
# end | |
class UrlValidator < ActiveModel::EachValidator | |
def validate_each(record, attribute, value) | |
unless valid_url?(value) | |
record.errors.add(attribute, :invalid_url) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This middleware dynamically switch a job queue based on its class name. | |
module TroubleshootMemoryMiddleware | |
module Client | |
class CustomQueueName | |
QUARANTINE_QUEUE = "quarantine" | |
def call(worker_class, job, queue, redis_pool) | |
# Jobs enqueued without ActiveJob are not wrapped. | |
job_class_name = if job["wrapped"].present? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Name of your application. Used to uniquely configure containers. | |
service: your-app-name | |
# Name of the container image. | |
image: your-org/your-app-name | |
# Deploy to these servers. | |
servers: | |
web: | |
- REPLACE_WITH_YOUR_WEB_DROPLET_IP |
OlderNewer