Skip to content

Instantly share code, notes, and snippets.

View seanpdoyle's full-sized avatar

Sean Doyle seanpdoyle

View GitHub Profile
@seanpdoyle
seanpdoyle / serialized_models.rb
Created July 25, 2024 21:04
Demonstrate how to use built-in Active Model and Active Record concepts to store JSON representations of Active Model instances in SQL
# frozen_string_literal: true
require "bundler/inline"
gemfile(true) do
source "https://rubygems.org"
gem "rails"
gem "sqlite3", "~> 1.4"
@seanpdoyle
seanpdoyle / application.rb
Last active February 15, 2024 23:06
Add a `binding.irb` to the test, then execute `ruby application.rb`
require "bundler/inline"
gemfile(true) do
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
gem "rails"
gem "sqlite3"
@seanpdoyle
seanpdoyle / 20140110012324_create_places.rb
Last active January 2, 2016 11:09
Code example for `paperclip-location`
require 'paperclip' #exclude this line in Rails apps
class CreatePlaces < ActiveRecord::Migration
include Paperclip::Schema #exclude this line in Rails apps
def self.change
create_table :places do |t|
t.boolean :location_locked, default: false, null: false
t.decimal :lat, precision: 10, scale: 15