-
Create a starting directory and enter it
mkdir test_setup && cd test_setup
-
Create a Gemfile inside of test_setup
-
Enter the following gems into your Gemfile:
source "https://rubygems.org"
gem 'rspec'
Create a starting directory and enter it
mkdir test_setup && cd test_setup
Create a Gemfile inside of test_setup
Enter the following gems into your Gemfile:
source "https://rubygems.org"
gem 'rspec'
rails new appname -d postgresql -T
psql -U username
create role approle with createdb login password 'password1';
config/database.yml
:
username: approle
password: password1
rails db:setup
Error: RecordNotFound Couldn't find User with 'id'="
Fix: as outlined on so
def current_user
@current_user ||= User.find_by(id: session[:user_id]) if session[:user_id]
end
Sometimes you want to have a subdirectory on the master
branch be the root directory of a repository’s gh-pages
branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master
branch alongside the rest of your code.
For the sake of this example, let’s pretend the subfolder containing your site is named dist
.
Remove the dist
directory from the project’s .gitignore
file (it’s ignored by default by Yeoman).
Picking the right architecture = Picking the right battles + Managing trade-offs
Create a Gem - Make it a Command Line Interface - Add Rspec Tests Using Bundler & Thor
#Creating your own Gem
module Braze | |
class << self | |
attr_accessor :configuration | |
end | |
def self.configure | |
self.configuration ||= Configuration.new | |
yield(configuration) | |
end |
module Facebook | |
class EventHandler | |
def call(record:, request_params:, type:) | |
@record = record | |
@request_params = request_params | |
@facebook_pixel_id = Rails.configuration.analytics_facebook_pixel_id | |
send_event(type) | |
end | |
private |
Set up and configure our DBMS of choice, MYSQL, to store and manage data. Additionally setup user credentials validation and reset MySQL default users, databases, etc.
sudo apt install -y mysql-server
After installation, it's recommended to purge some insecure default settings and lock down access to the database system. The first thing we should do is set a password for the root
password (using mysql_native_password as our default authentication method**)** as by default it has none - a huge security risk.