Skip to content

Instantly share code, notes, and snippets.

View hebergentilin's full-sized avatar

Heber Gentilin hebergentilin

View GitHub Profile
@benzittlau
benzittlau / merge_defaults.rb
Created February 10, 2017 20:16
Merging defaults with options hash in a ruby function
# Related area of style guide: https://github.com/GetJobber/ruby-style-guide#hash-fetch-defaults
# Pros: Is succinct and intuitive
# Cons: Doesn't work for false values
def default_one(options)
options[:foo] ||= 'foo'
options[:bar] ||= 'bar'
end
# Pros: Handles false without issue, is succient
@maxivak
maxivak / __readme.md
Last active May 26, 2023 03:50
Custom Rails Mailer

Custom Rails Mailer (custom deliver_method)

ActionMailer deliver_method can be different like :smtp, :test, etc.

We will create a new custom delivery method to do something along with (or instead of) sending email.

Create class for delivery