Replace IRB with Pry (in your Gemfile) and Byebug with pry-byebug
.
gem 'pry-rails', group: [:development, :test]
gem 'pry-byebug', group: [:development, :test]
#!/usr/bin/env bash | |
# idea from https://www.devside.net/wamp-server/load-testing-apache-with-ab-apache-bench | |
# if you are testing a base url, you need a trailing slash | |
SITE="http://example.com/" | |
OUTFILE="output.txt" | |
DIVIDER="\n====================================================================\n" | |
# if the file doesnt exist, make it |
# Original from http://snippets.dzone.com/posts/show/4468 by MichaelBoutros | |
# | |
# Optimized version which uses to_yaml for content creation and checks | |
# that models are ActiveRecord::Base models before trying to fetch | |
# them from database. | |
namespace :db do | |
namespace :fixtures do | |
desc 'Dumps all models into fixtures.' | |
task :dump => :environment do | |
models = Dir.glob(Rails.root + 'app/models/**.rb').map do |s| |
# lib/tasks/db_fixtures_export.rake | |
namespace 'db:fixtures' do | |
desc "generate fixtures from the current database" | |
task :export => :environment do | |
Rails.application.eager_load! | |
models = defined?(AppicationRecord) ? ApplicationRecord.decendants : ActiveRecord::Base.descendants | |
models.each do |model| | |
puts "exporting: #{model}" |
# https://gist.github.com/kuboon/55d4d8e862362d30456e7aa7cd6c9cf5 | |
namespace 'db:fixtures' do | |
desc "generate fixtures from the current database" | |
task :export => :environment do | |
Rails.application.eager_load! | |
models = defined?(ApplicationRecord) ? ApplicationRecord.descendants : ActiveRecord::Base.descendants | |
models.each do |model| | |
puts "exporting: #{model}" |
ruby '2.7.1' | |
gem 'rails', github: 'rails/rails' | |
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data | |
# Action Text | |
gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra' | |
gem 'okra', github: 'basecamp/okra' | |
# Drivers |
exFAT support on macOS seems to have some bugs because my external drives with exFAT formatting will randomly get corrupted.
Disk Utility is unable to repair this at first, but the fix is this:
diskutil list
to find the right drive id.disk1s1
sudo fsck_exfat -d <id from above>
. eg sudo fsck_exfat -d disk1s3
-d
is debug so you'll see all your files output as they're processed.YES
if it gives you the prompt Main boot region needs to be updated. Yes/No?
This is a simplified, but fairly thorough, set of scripts and configuration to enable Heroku Release Phase for Rails apps.
Further, this particular set up plays nicely with Heroku Review Apps in that the release
phase script will:
bin/rails db:version
) is 0
.For a "normal" app that usually means it will run the DB migrations.
Slides : https://speakerdeck.com/derekprior/in-relentless-pursuit-of-rest Talk : https://www.youtube.com/watch?v=HctYHe-YjnE
REST help rails growing
More small things (small models, controllers, services, views...)
[Anti-pattern] Custom actions
noun#verb_noun
(users#edit_password
, users#update_password
) = Missing resourceStreaming just means a download that they don't want you to keep. But Chrome's developer tools make it easy to access what's really going on under the hood.
From the page where you want to download some things, go into your chrome menu to open the developer tools. You can either:
1. (On a mac): Command-option-J
2. (On a PC): Control-alt-J