Skip to content

Instantly share code, notes, and snippets.

View dresselm's full-sized avatar
💭
reviewing PRs

Matt Dressel dresselm

💭
reviewing PRs
View GitHub Profile
# I am assuming you have a User model with a
# has_many :people association?
def create
# Your params for Person creation are found on the params[:person]
# I do not understand what you are doing here. Basically, what's going
# on - if an organisation is selected, you are building the person off of
# the organisation relationship. Your form, however, revolves around people, not
# organisations.
# So, get rid of the complexity below
class Organisation < ActiveRecord::Base
has_many :people
has_one :address, :as => :addressable,
:dependent => :destroy
accepts_nested_attributes_for :address, :allow_destroy => true
end
class Person < ActiveRecord::Base
@dresselm
dresselm / Results
Last active December 20, 2015 08:19
Solution1 valid: true
Solution1: 2.280000 0.000000 2.280000 ( 2.275380)
Solution2 valid: true
solution2: 1.220000 0.000000 1.220000 ( 1.222917)
Solution3 valid: true
solution3: 1.470000 0.010000 1.480000 ( 1.481871)
Solution4 valid: true
solution4: 2.080000 0.000000 2.080000 ( 2.075977)
=> [
2.280000 0.000000 2.280000 ( 2.275380),
#!/bin/sh
function print_header() {
echo "\n------------------------------------------------------------------------"
echo $1
echo "------------------------------------------------------------------------\n"
}
# Checkout master to ensure that we are dealing with topic branches in our cleanup
git co master
@dresselm
dresselm / simple_twitter_parser.rb
Last active August 11, 2016 01:56
RubyHackNight
# Problem: http://www.puzzlenode.com/puzzles/14-six-degrees-of-separation
# sample.txt
# ----------
# alberta: @bob "It is remarkable, the character of the pleasure we derive from the best books."
# bob: "They impress us ever with the conviction that one nature wrote and the same reads." /cc @alberta
# alberta: hey @christie. what will we be reading at the book club meeting tonight?
# christie: 'Every day, men and women, conversing, beholding and beholden.' /cc @alberta, @bob
# bob: @duncan, @christie so I see it is Emerson tonight
# duncan: We'll also discuss Emerson's friendship with Walt Whitman /cc @bob

Keybase proof

I hereby claim:

  • I am dresselm on github.
  • I am mattycakes (https://keybase.io/mattycakes) on keybase.
  • I have a public key ASDBDfOfS9uIsyuLuNTJzg9-jL1u19rQ830froIjmv4H9wo

To claim this, I am signing this object: