Skip to content

Instantly share code, notes, and snippets.

View marcelolx's full-sized avatar
:shipit:
from home

Marcelo Lauxen marcelolx

:shipit:
from home
View GitHub Profile

Rails naming conventions

General Ruby conventions

Class names are CamelCase.

Methods and variables are snake_case.

Methods with a ? suffix will return a boolean.

@marcelolx
marcelolx / labels.css
Created August 13, 2020 21:08 — forked from gavinblair/labels.css
Adds : after labels and * after required labels
/* Adds : after labels */
form label:after{
content:":";
}
/* Adds * after required labels */
form label.required:after{
content:"*";
}
@marcelolx
marcelolx / remove_sql_from_errors.rb
Created July 6, 2020 14:42 — forked from timraasveld/remove_sql_from_errors.rb
Remove SQL queries from exceptions on Rails production / staging
# config/initializers/hide_sql_from_errors.rb
# Monkey patch ActiveRecord to not show executed statements in production errors.
# Without this patch, error reporting services such as AppSignal would receive
# sensitive data used in failed queries.
# Use `class_eval` on AbstractAdapter instead of first defining a module and
# then including it, because otherwise our patch would sometimes be overridden
# by Rails' class autoloading
ActiveRecord::ConnectionAdapters::AbstractAdapter.class_eval do
@marcelolx
marcelolx / rspec_model_testing_template.rb
Created June 3, 2020 21:29
Rails Rspec model testing skeleton & cheat sheet using rspec-rails, shoulda-matchers, shoulda-callbacks, and factory_girl_rails. Pretty much a brain dump of examples of what you can (should?) test in a model. Pick & choose what you like, and please let me know if there are any errors or new/changed features out there. Reddit comment thread: http…
# This is a skeleton for testing models including examples of validations, callbacks,
# scopes, instance & class methods, associations, and more.
# Pick and choose what you want, as all models don't NEED to be tested at this depth.
#
# I'm always eager to hear new tips & suggestions as I'm still new to testing,
# so if you have any, please share!
#
# @kyletcarlson
#
# This skeleton also assumes you're using the following gems: