This is the companion to my YouTube video: https://youtu.be/MJSZ3WcgHeE
https://guides.rubyonrails.org/debugging_rails_applications.html
- Putting debug info into views using
debug
helper (orto_yaml
orinspect
)
#!/bin/bash | |
set -euo pipefail | |
######################## | |
### SCRIPT VARIABLES ### | |
######################## | |
# Name of the user to create and grant sudo privileges | |
USERNAME=deploy |
PORT=3000 | |
# postgresql | |
POSTGRES_HOST=localhost | |
POSTGRES_PORT=54323 | |
POSTGRES_DBUSER=postgres | |
POSTGRES_PASSWORD=philsmy123 | |
# mysql | |
MYSQL_DBNAME=lotteryportal_development |
This is the companion to my YouTube video: https://youtu.be/MJSZ3WcgHeE
https://guides.rubyonrails.org/debugging_rails_applications.html
debug
helper (or to_yaml
or inspect
)# frozen_string_literal: true | |
class OntarioController < ApplicationController | |
protect_from_forgery except: :map_data | |
def map_data | |
@patients = PatientDatum.where(region: 'ON').group(:reporter, :reporter_latitude, :reporter_longitude, :reporter_website).count | |
@patient_map = @patients.keys.map do |key| | |
{ | |
'type': 'Feature', |
<% content_for :page_header do %> | |
<style> | |
#map { | |
height: 80%; | |
margin-top: 30px; | |
} | |
html, body { | |
height: 100%; | |
margin: 0; | |
padding: 0; |
# frozen_string_literal: true | |
require 'csv' | |
class PatientDatum < ApplicationRecord | |
def self.import_from_csv | |
columns = %i[external_id episode_date age_group gender acquisition_info outcome reporter reporter_address reporter_city reporter_postal_code reporter_website reporter_latitude reporter_longitude country region] | |
upsert_columns = %i[episode_date age_group gender acquisition_info outcome reporter reporter_address reporter_city reporter_postal_code reporter_website reporter_latitude reporter_longitude] | |
values = CSV.read(Rails.root.join('data/conposcovidloc.csv'))[1..-1] |
import { Controller } from "stimulus" | |
import $ from 'jquery'; | |
export default class extends Controller { | |
connect() { | |
console.log('connecting Filter controller'); | |
$("#subscriber-tags-select").on('select2:select', function () { |
import { Controller } from "stimulus" | |
import $ from 'jquery'; | |
require("select2/dist/css/select2") | |
require("select2-bootstrap-theme/dist/select2-bootstrap") | |
import Select2 from "select2" | |
export default class extends Controller { |
brew search mysql
brew install [email protected]
brew link [email protected] --force --overwrite
# app/jobs/sample_job.rb | |
class SampleJob < ActiveJob::Base | |
queue_as :maintenance | |
attr_accessor :options | |
def enqueue(options = {}) | |
self.options = options | |
super | |
end |