Skip to content

Instantly share code, notes, and snippets.

mkessler / has_one_through_bug.rb
Last active Oct 14, 2021 — forked from zachwalton/has_one_through_bug.rb
has_one through not available on unpersisted instances
View has_one_through_bug.rb
# frozen_string_literal: true
require "bundler/inline"
rescue LoadError => e
$stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler"
raise e
gemfile(true) do
View devise_with_scrypt_or_bcrypt.rb
require 'devise'
require 'devise/models/database_authenticatable'
require 'bcrypt'
rescue LoadError
mkessler / private_player_info.rb
Created Apr 22, 2019
Hide roster/registrant contact info and age
View private_player_info.rb
d = Division.find(DIVISION_ID)
# Hide all roster contact info and age
d.all_controlled_active_rosters.each do |roster|
roster.hide_address = true
roster.hide_age = true
roster.hide_email_address = true
roster.roster_telephones.each do |roster_telephone|
View Send Email
if store = Store.find_by_email(params['sender'])
puts "Store exists for #{params['sender']}"
message_url = params['message-url'].gsub('https://', '') "https://api:#{ENV['MAILGUN_API_KEY']}"\
to: ""
head 200
mkessler / bootstrap_breadcrumbs_builder.rb
Last active Oct 29, 2019 — forked from bjensen/bootstrap_breadcrumbs_builder.rb
How to make breadcrumbs_on_rails render a Bootstrap 4 compatible breadcrumb navigation
View bootstrap_breadcrumbs_builder.rb
# The BootstrapBreadcrumbsBuilder is a Bootstrap compatible breadcrumb builder.
# It provides basic functionalities to render a breadcrumb navigation according to Bootstrap 4's conventions.
# You can use it with the :builder option on render_breadcrumbs:
# <%= render_breadcrumbs builder: ::BootstrapBreadcrumbsBuilder %>
# Note: You may need to adjust the autoload_paths in your config/application.rb file for rails to load this class:
# config.autoload_paths += %W(#{config.root}/lib)
class BootstrapBreadcrumbsBuilder < BreadcrumbsOnRails::Breadcrumbs::Builder
View staff_directory.html.erb
<div class="staff-directory">
<h1>Acme Corporation Employee Directory</h1>
<% @staff_members.each do |member| %>
<div class="staff-member">
<div class="staff-member-name"><%= %></div>
<div class="staff-member-title"><%= member.title %></div>
<p class="staff-member-bio"><%= %></p>
<img class="staff-member-image" src="<%= member.image %>" alt="<%= %>" />
<% end %>