Use ruby's [Method#source_location][1] to determine where a method is defined.
method(:s).source_location
# => ["..snip../gems/sexp_processor-4.2.1/lib/sexp.rb", 332]
require 'pp' | |
require 'set' | |
# Which days are students available? | |
STUDENTS = [ | |
# Mon. Tue. Wed. Thurs. Fri. | |
[ true, true, false, false, false], # Student 1 | |
[ true, false, false, false, false], # Student 2 | |
[false, true, true, false, false], # etc ... | |
[false, true, false, true, true], |
# https://github.com/airblade/paper_trail/issues/594 | |
# Use this template to report PaperTrail bugs. | |
# It is based on the ActiveRecord template. | |
# https://github.com/rails/rails/blob/master/guides/bug_report_templates/active_record_gem.rb | |
begin | |
require 'bundler/inline' | |
rescue LoadError => e | |
$stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler' | |
raise e |
# https://github.com/airblade/paper_trail/issues/663 | |
# Use this template to report PaperTrail bugs. | |
# It is based on the ActiveRecord template. | |
# https://github.com/rails/rails/blob/master/guides/bug_report_templates/active_record_gem.rb | |
begin | |
require 'bundler/inline' | |
rescue LoadError => e | |
$stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler' | |
raise e |
Loading development environment (Rails 4.2.3) | |
irb(main):001:0> s = Subgroup.create!(name: "sub") | |
(0.1ms) begin transaction | |
SQL (0.3ms) INSERT INTO "subgroups" ("name", "created_at", "updated_at") VALUES (?, ?, ?) [["name", "sub"], ["created_at", "2015-07-27 20:23:35.477973"], ["updated_at", "2015-07-27 20:23:35.477973"]] | |
SQL (0.2ms) INSERT INTO "versions" ("event", "created_at", "item_id", "item_type") VALUES (?, ?, ?, ?) [["event", "create"], ["created_at", "2015-07-27 20:23:35.477973"], ["item_id", 1], ["item_type", "Subgroup"]] | |
SQL (0.3ms) UPDATE "versions" SET "transaction_id" = ? WHERE "versions"."id" = ? [["transaction_id", 1], ["id", 1]] | |
(2.3ms) commit transaction | |
=> #<Subgroup id: 1, name: "sub", created_at: "2015-07-27 20:23:35", updated_at: "2015-07-27 20:23:35"> | |
irb(main):002:0> f = Faq.create!(name: "faq", subgroups: [s]) | |
(0.1ms) begin transaction |
PID/THRD SYSCALL(args) = return | |
18235/0x163c3b: execve("/Users/jared/bin/bash\0", 0x7FFF5310DBA8, 0x7FFF5310DBC8) = -1 Err#2 | |
18235/0x163c3b: execve("/usr/local/bin/bash\0", 0x7FFF5310DBA8, 0x7FFF5310DBC8) = -1 Err#2 | |
18235/0x163c3b: execve("/Users/jared/.rbenv/shims/bash\0", 0x7FFF5310DBA8, 0x7FFF5310DBC8) = -1 Err#2 | |
18235/0x163c3b: execve("/Users/jared/.rbenv/bin/bash\0", 0x7FFF5310DBA8, 0x7FFF5310DBC8) = -1 Err#2 | |
18235/0x163c3b: execve("/usr/local/heroku/bin/bash\0", 0x7FFF5310DBA8, 0x7FFF5310DBC8) = -1 Err#2 | |
18235/0x163c3b: execve("/usr/bin/bash\0", 0x7FFF5310DBA8, 0x7FFF5310DBC8) = -1 Err#2 | |
18235/0x163c3b: thread_selfid(0x0, 0x1DC0, 0x7FFF671FD550) = 1457211 0 | |
18235/0x163c3b: csops(0x0, 0x0, 0x7FFF5310D294) = 0 0 | |
18235/0x163c3b: issetugid(0x0, 0x0, 0x0) = 0 0 |
Process: webkit_server [4641] | |
Path: /Users/USER/*/webkit_server | |
Identifier: webkit_server | |
Version: ??? | |
Code Type: X86-64 (Native) | |
Parent Process: ruby [4637] | |
User ID: 501 | |
Date/Time: 2013-06-12 17:00:06.378 -0400 | |
OS Version: Mac OS X 10.8.3 (12D78) |
#!/usr/bin/env ruby | |
# | |
# `Puller` exports a heroku database, and overwrites the specified | |
# local database. See "Importing and Exporting Heroku Postgres | |
# Databases with PG Backups" (http://bit.ly/15Udpfl) | |
# -Jared Beck 2013-06-07 | |
# | |
class Puller | |
def initialize args |
source 'https://rubygems.org' | |
ruby '2.0.0' | |
gem 'rails', '3.2.13' | |
gem 'pg' | |
gem 'taps' | |
# Web server | |
gem 'unicorn' |