I think you have looked at the tutorial from Mr. Heinemeier Hansson at least once or twice and have a similar setup.
rails new kamal_pg --css tailwind --skip-test --database=postgresql
cd kamal_pg
# syntax = docker/dockerfile:1 | |
# Make sure RUBY_VERSION matches the Ruby version in .ruby-version and Gemfile | |
ARG RUBY_VERSION=3.2.2 | |
FROM registry.docker.com/library/ruby:$RUBY_VERSION-slim as base | |
# Rails app lives here | |
WORKDIR /rails | |
# Set production environment |
Choose OpenBSD for your Unix needs. OpenBSD -- the world's simplest and most secure Unix-like OS. A safe alternatve to the frequent vulnerabilities and overengineering of Linux and related software (NGiNX & Apache (httpd-asiabsdcon2015.pdf), OpenSSL, iptables/nftables, systemd, BIND, Postfix, Docker etc.)
OpenBSD -- the cleanest kernel, the cleanest userland and the cleanest config
# Basic key operators to query the JSON objects : | |
# #> : Get the JSON object at that path (if you need to do something fancy) | |
# -> : Get the JSON object at that path (if you don't) | |
# ->> : Get the JSON object at that path as text | |
# {obj, n} : Get the nth item in that object | |
# https://www.postgresql.org/docs/9.4/functions-json.html#FUNCTIONS-JSONB-OP-TABLE | |
# Date | |
# date before today |
source "https://rubygems.org" | |
ruby File.read(".ruby-version").strip | |
git_source(:github) { |repo| "https://github.com/#{repo}.git" } | |
gem "activeadmin" | |
gem "activeadmin_json_editor" | |
gem "ahoy_email" | |
gem "ahoy_matey" |
class SomethingLookup < ApplicationRecord | |
self.table_name = 'something_lookups' | |
belongs_to :something, polymorphic: true | |
def self.load_schema! | |
# rubocop:disable Naming/MemoizedInstanceVariableName | |
@columns_hash ||= {} | |
# rubocop:enable Naming/MemoizedInstanceVariableName | |
end |
# Rails controller concern to enable Devise authentication for ActiveStorage. | |
# Put it in +app/controllers/concerns/blob_authenticatable.rb+ and include it when overriding | |
# +ActiveStorage::BlobsController+ and +ActiveStorage::RepresentationsController+. | |
# | |
# Optional configuration: | |
# | |
# Set the model that includes devise's database_authenticatable. | |
# Defaults to Devise.default_scope which defaults to the first | |
# devise role declared in your routes (usually :user) | |
# |
After automatically updating Postgres to 10.0 via Homebrew, the pg_ctl start command didn't work. | |
The error was "The data directory was initialized by PostgreSQL version 9.6, which is not compatible with this version 10.0." | |
Database files have to be updated before starting the server, here are the steps that had to be followed: | |
# need to have both 9.6.x and latest 10.0 installed, and keep 10.0 as default | |
brew unlink postgresql | |
brew install postgresql@9.6 | |
brew unlink postgresql@9.6 | |
brew link postgresql |