Skip to content

Instantly share code, notes, and snippets.

@iangreenleaf
iangreenleaf / gist:b206d09c587e8fc6399e
Last active May 5, 2024 14:52
Rails naming conventions

Rails naming conventions

General Ruby conventions

Class names are CamelCase.

Methods and variables are snake_case.

Methods with a ? suffix will return a boolean.

@jmccartie
jmccartie / unsubscribe.rb
Created September 23, 2012 22:53
Don't deliver email if the address is on a blacklist
class EmailAddressFilter
def self.delivering_email(message)
message.perform_deliveries = false
# Remove email from message.to if email is on the unsubscribe list
tos = message.to.to_a
message.to.each do |email|
tos.delete(email) if Unsubscribe.find_by_email(email)
end
message.to = tos # can't delete directly from message.to. probably a better way to do this...