This gist will collect all issues we solved with Rails 5.2 and Webpacker
# Last few parameters(--skip-* part) is only my habbit not actully required
$ rails new --webpack=stimulus --database=postgresql --skip-coffee --skip-test
/** | |
* Delete an image from the S3 Bucket | |
* | |
* @author Daveyon Mayne <@MirMayne> | |
* @date July 14th 2019 | |
*/ | |
const AWS = require('aws-sdk'); | |
const deletePhoto = async (avatar_url) => { |
/** | |
* This gist was inspired from https://gist.github.com/homam/8646090 which I wanted to work when uploading an image from | |
* a base64 string. | |
* Updated to use Promise (bluebird) | |
* Web: https://mayneweb.com | |
* | |
* @param {string} base64 Data | |
* @return {string} Image url | |
*/ | |
const imageUpload = async (base64) => { |
# app/jobs/example_job.rb | |
class ExampleJob < ActiveJob::Base | |
queue_as :default | |
rescue_from(ActiveRecord::RecordNotFound) do | |
retry_job wait: 1.minute, queue: :default | |
end | |
def perform(param_1, param_2) |
class MyJob < ActiveJob::Base | |
queue_as :urgent | |
rescue_from(NoResultsError) do | |
retry_job wait: 5.minutes, queue: :default | |
end | |
def perform(*args) | |
MyService.call(*args) | |
end |
require 'observer' | |
class CoffeeShop | |
include Observable | |
attr_reader :customers | |
def initialize(name, capacity) | |
@name = name | |
@capacity = capacity | |
@customers = [] |