rails new app-name -d postgresql -j esbuild --css bootstrap
bin/rails g system_test quotes
# deps and their versions in gemspec | |
cat name.gemspec | ag -o '(?<=dependency).*(?<=[<>=]\s)(?>\d+\.?\d+)' | tr -d "',><=~" | |
# deps and their version on RubyGems | |
cat british.gemspec | ag -o '(?<=dependency).*(?<=[<>=]\s)(?>\d+\.?\d+)' | tr -d "',><=~" | awk '{ print $1 }' | xargs gem info -r | ag '\(\d+\.\d+\.\d+\)' | |
# gemspec and current remote versions side-by-side | |
paste <(cat $(ls | ag gemspec) | ag -o '(?<=dependency).*(?<=[<>=]\s)(?>\d+\.?\d+)' | tr -d "',><=~") <(cat $(ls | ag gemspec) | ag -o '(?<=dependency).*(?<=[<>=]\s)(?>\d+\.?\d+)' | tr -d "',><=~" | awk '{ print $1 }' | xargs gem info -r | ag -o '(?<=\()(\d+\.\d+\.\d+)(?!>\))') |
# From http://garmoncheg.blogspot.com/2012/06/pretty-git-log.html | |
git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --" |
#!/usr/bin/env ruby | |
# frozen_string_literal: true | |
require "socket" | |
class Connection | |
def initialize(client:, server:) | |
@client = client | |
@server = server | |
end |
namespace :db do | |
desc "Outputs any invalid data records" | |
task :invalid_records => :environment do | |
puts "\n** Testing record validating in #{Rails.env.capitalize} environment**\n" | |
ActiveRecord::Base.send(:subclasses).each do |model| | |
puts "#{model} records (#{model.count})" | |
next if model.count == 0 | |
invalid = model.all.reject(&:valid?) | |
if invalid.size.zero? |
# frozen_string_literal: true | |
# | |
# Uncomment this and change the path if necessary to include your own | |
# components. | |
# See https://github.com/heartcombo/simple_form#custom-components to know | |
# more about custom components. | |
# Dir[Rails.root.join('lib/components/**/*.rb')].each { |f| require f } | |
# | |
# Use this setup block to configure all options available in SimpleForm. | |
SimpleForm.setup do |config| |
``` | |
** Invoke db:environment:set (first_time) | |
** Invoke db:load_config (first_time) | |
** Invoke environment (first_time) | |
** Execute environment | |
** Execute db:load_config | |
** Execute db:environment:set | |
** Invoke db:schema:load (first_time) | |
** Invoke db:load_config | |
** Invoke db:check_protected_environments (first_time) |
== Command ["bin/rails db:prepare"] failed == | |
➜ railsdevs.com git:(main) ✗ git status | |
On branch main | |
Your branch is up to date with 'origin/main'. | |
Changes not staged for commit: | |
(use "git add <file>..." to update what will be committed) | |
(use "git restore <file>..." to discard changes in working directory) | |
modified: db/migrate/20211028230858_create_active_storage_tables.active_storage.rb | |
modified: db/migrate/20211128095707_create_businesses.rb |
class AddIndexForSearchableFieldsInDevelopers < ActiveRecord::Migration[7.0] | |
def up | |
execute <<-SQL | |
ALTER TABLE developers | |
ADD COLUMN textsearchable_index_col tsvector | |
GENERATED ALWAYS AS (to_tsvector('simple', coalesce(hero, '') || ' ' || coalesce(bio, ''))) STORED; | |
SQL | |
add_index :developers, :textsearchable_index_col, using: :gin, name: :textsearchable_index | |
end |
➜ railsdevs.com git:(local) bin/setup | |
== Installing dependencies == | |
https://github.com/Shopify/erb-lint.git is not yet checked out. Run `bundle install` first. | |
Bundler 2.3.12 is running, but your lockfile was generated with 2.3.4. Installing Bundler 2.3.4 and restarting using that version. | |
Fetching gem metadata from https://rubygems.org/. | |
Fetching bundler 2.3.4 | |
Installing bundler 2.3.4 | |
Fetching gem metadata from https://rubygems.org/......... | |
Fetching https://github.com/Shopify/erb-lint.git | |
Fetching https://github.com/pay-rails/pay.git |