Skip to content

Instantly share code, notes, and snippets.

View DougHall's full-sized avatar

Doug Hall DougHall

  • Pike Road, AL USA
View GitHub Profile
@DougHall
DougHall / gist:3875089
Created October 11, 2012 19:55
ScoreSession model
class ScoreSession < ActiveRecord::Base
belongs_to :assessor, :class_name => "User"
has_many :station_scores, :dependent => :destroy
has_many :trainees, :through => :station_scores
attr_accessor :cluster, :line
validates_presence_of :cluster, :line
accepts_nested_attributes_for :station_scores, :reject_if => :all_blank
def cluster_val
@DougHall
DougHall / Rails console clip
Created October 11, 2012 19:47
ActiveRecord record save not getting parameters
>> ss = ScoreSession.create!(:assessor_id => 2,:group_id => 4, :cluster => "B", :line => "C")
(0.5ms) BEGIN
SQL (68.0ms) INSERT INTO "score_sessions" ("assessor_id", "cluster", "created_at", "ended_at", "group_id", "line", "updated_at") VALUES ($1, $2, $3, $4, $5, $6, $7) RETURNING "id" [["assessor_id", 2], ["cluster", nil], ["created_at", Thu, 11 Oct 2012 14:42:05 CDT -05:00], ["ended_at", nil], ["group_id", 4], ["line", nil], ["updated_at", Thu, 11 Oct 2012 14:42:05 CDT -05:00]]
(0.1ms) ROLLBACK
ActiveRecord::StatementInvalid: PG::Error: ERROR: null value in column "line" violates not-null constraint
DETAIL: Failing row contains (13, 2, null, 2012-10-11 19:42:05.959018, 2012-10-11 19:42:05.959018, null, 4, null).
@DougHall
DougHall / no_rvm_thats_not_what_i_said_to_do
Created December 8, 2011 22:37
rvm session, problem renaming gemsets
mu163:stations dhall$ rvm gemset list
gemsets for ruby-1.9.2-p290 (found in /Users/dhall/.rvm/gems/ruby-1.9.2-p290)
global
j3
ostations
rails
static
stations
=> stations313
@DougHall
DougHall / Guardfile
Created October 28, 2011 15:11
Simple guardfile
# A sample Guardfile
# More info at https://github.com/guard/guard#readme
require 'guard/guard'
module ::Guard
class CalGuard < ::Guard::Guard
def print_me(paths)
paths.each do |filepath|
@DougHall
DougHall / Guardfile2
Created October 27, 2011 22:38
guard guardfile for monitoring changes and deletions of *.ics files
# A sample Guardfile
# More info at https://github.com/guard/guard#readme
require "/Users/dhall/work/scripts/ruby/calendars/cal_concatenator"
require 'logger'
require 'guard/guard'
module ::Guard
class CalGuard < ::Guard::Guard
@DougHall
DougHall / .Guardfile
Created October 26, 2011 18:21
ics guardfile
# A sample Guardfile
# More info at https://github.com/guard/guard#readme
require "~/work/scripts/ruby/calendars/cal_concatenator"
require 'logger'
require 'guard/guard'
module ::Guard
class CalGuard < ::Guard::Guard
@DougHall
DougHall / gist:1138024
Created August 10, 2011 19:59
Gemfile
source 'http://rubygems.org'
gem 'rails', :git => 'https://github.com/rails/rails.git', :branch => '3-1-stable'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
# Asset template engines
@DougHall
DougHall / cukepuke
Created August 10, 2011 18:48
Cucumber pukes
rvm/gems/ruby-1.9.2-p290@stations/gems/railties-3.1.0.rc5/lib/rails/engine.rb:536>>, #<Rails::Initializable::Initializer:0x000001043986b8 @name=:append_assets_path, @context=#<Stations::Application:0x00000104537c58 ...>, @options={:after=>:load_environment_config}, @block=#<Proc:0x00000100bfd870@/Users/dhall/.rvm/gems/ruby-1.9.2-p290@stations/gems/railties-3.1.0.rc5/lib/rails/engine.rb:541>>, #<Rails::Initializable::Initializer:0x00000104398668 @name=:prepend_helpers_path, @context=#<Stations::Application:0x00000104537c58 ...>, @options={:after=>:append_assets_path}, @block=#<Proc:0x00000100bfd780@/Users/dhall/.rvm/gems/ruby-1.9.2-p290@stations/gems/railties-3.1.0.rc5/lib/rails/engine.rb:547>>, #<Rails::Initializable::Initializer:0x00000104398618 @name=:load_config_initializers, @context=#<Stations::Application:0x00000104537c58 ...>, @options={:after=>:prepend_helpers_path}, @block=#<Proc:0x00000100bfd5a0@/Users/dhall/.rvm/gems/ruby-1.9.2-p290@stations/gems/railties-3.1.0.rc5/lib/rails/engine.rb:553>>, #<Rail
@DougHall
DougHall / gist:988737
Created May 24, 2011 13:52
git log -p of directory that's turned binary
itdev$ git log -p jobs/app/models
commit 70211fadbb933bc5a4623461e62f2a75c206f84c
Author: ddfgsdfgsdfgsdfg
Date: Sun Feb 27 15:22:20 2011 -0600
Bring up the jobs replacement I wrote back in aug. Cleaned up enough to test and see if they want to persue
diff --git a/jobs/app/models/apply.a4l b/jobs/app/models/apply.a4l
new file mode 100644
index 0000000..774bd54
@DougHall
DougHall / rvm_list_trace.txt
Created May 9, 2011 13:10
rvm list problem
$ rvm get head
Original installed RVM version:
rvm 1.6.5 by Wayne E. Seguin (wayneeseguin@gmail.com) [https://rvm.beginrescueend.com/]
remote: Counting objects: 36, done.
remote: Compressing objects: 100% (28/28), done.
remote: Total 28 (delta 20), reused 0 (delta 0)
Unpacking objects: 100% (28/28), done.