Skip to content

Instantly share code, notes, and snippets.

View base10's full-sized avatar

Nathan L. Walls base10

View GitHub Profile
Processing ContactsController#create (for 0.0.0.0 at 2009-03-23 22:17:28) [POST]
Parameters: {"action"=>"create", "controller"=>"contacts"}
NoMethodError (You have a nil object when you didn't expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.[]):
def post_contact_json
contact = {
:contact => {
:email => '[email protected]',
:verify_email => '[email protected]',
:first_name => 'joe',
:last_name => 'test',
:phone => '919-555-1212',
:responses_attributes => {
SetEnv NoAds true
<!--#if expr="!${NoAds}" -->
<script src="http://www.example.com/foo.js" type="text/javascript"></script>
<!--#endif -->
#!/usr/bin/env ruby
command = '/usr/bin/passenger-memory-stats'
memory_limit = 200 # megabytes
def running?(pid)
begin
return Process.getpgid(pid) != -1
rescue Errno::ESRCH
return false
## Copyright 2009 Rex Luther Corporation.
## Licensed under the MIT License
## http://www.opensource.org/licenses/mit-license.php
it "should require a phone number have a valid format" do
@contact.phone = '(919) 555-1212'
@contact.should be_valid
@contact.phone = '919-555-1212'
@contact.should be_valid
## Copyright 2009 Rex Luther Corporation.
## Licensed under the MIT License
## http://www.opensource.org/licenses/mit-license.php
def valid_phone
return true if phone.blank?
phone_formats = [
/^\(\d\d\d\) \d\d\d-\d\d\d\d/,
/^\d\d\d\.\d\d\d\.\d\d\d\d/,