Skip to content

Instantly share code, notes, and snippets.

View wenbert's full-sized avatar

Wenbert Del Rosario wenbert

View GitHub Profile
1.9.2-p290 :001 > a = Allergy.all
Allergy Load (0.2ms) SELECT "allergies".* FROM "allergies"
=> [#<Allergy id: 1, name: "Milk", desc: "Allergic to milk", created_at: "2012-01-08 16:38:55", updated_at: "2012-01-09 11:48:20", patient_id: 1>, #<Allergy id: 2, name: "Blah", desc: "Test", created_at: "2012-01-09 12:20:48", updated_at: "2012-01-09 12:20:48", patient_id: 2>]
1.9.2-p290 :002 > b = a[0]
=> #<Allergy id: 1, name: "Milk", desc: "Allergic to milk", created_at: "2012-01-08 16:38:55", updated_at: "2012-01-09 11:48:20", patient_id: 1>
1.9.2-p290 :003 > b.full_name
NoMethodError: undefined method `full_name' for #<Allergy:0x20429e4>
from /Users/wenbert/.rvm/gems/ruby-1.9.2-p290/gems/activemodel-3.1.3/lib/active_model/attribute_methods.rb:385:in `method_missing'
from /Users/wenbert/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.3/lib/active_record/attribute_methods.rb:60:in `method_missing'
from (irb):3
class AllergiesControllerTest < ActionController::TestCase
setup do
@allergy = allergies(:one)
@allergy.patient = patients(:one)
end
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:allergies)
1.9.2-p290 :005 > a = Allergy.all
Allergy Load (0.5ms) SELECT "allergies".* FROM "allergies"
=> [#<Allergy id: 1, name: "Milk", desc: "Allergic to milk", created_at: "2012-01-08 16:38:55", updated_at: "2012-01-09 11:48:20", patient_id: 1>, #<Allergy id: 2, name: "Blah", desc: "Test", created_at: "2012-01-09 12:20:48", updated_at: "2012-01-09 12:20:48", patient_id: 2>]
1.9.2-p290 :006 > a[0]
=> #<Allergy id: 1, name: "Milk", desc: "Allergic to milk", created_at: "2012-01-08 16:38:55", updated_at: "2012-01-09 11:48:20", patient_id: 1>
1.9.2-p290 :007 > a[0].full_name
NoMethodError: undefined method `full_name' for #<Allergy:0x1720870>
from /Users/wenbert/.rvm/gems/ruby-1.9.2-p290/gems/activemodel-3.1.3/lib/active_model/attribute_methods.rb:385:in `method_missing'
from /Users/wenbert/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.3/lib/active_record/attribute_methods.rb:60:in `method_missing'
from (irb):7
AllergiesControllerTest:
PASS should create allergy (0.17s)
PASS should destroy allergy (0.01s)
PASS should get edit (0.12s)
ERROR should get index (0.16s)
ActionView::Template::Error: undefined method `full_name' for nil:NilClass
/Users/wenbert/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.3/lib/active_support/whiny_nil.rb:48:in `method_missing'
require 'test_helper'
class AllergiesControllerTest < ActionController::TestCase
setup do
@allergy = allergies(:one)
end
test "should get index" do
get :index
assert_response :success
@wenbert
wenbert / expired_in_123signup_and_not_in_cfai_list.sql
Created December 2, 2011 11:34
4. All those in the 123signup list who are listed as EXPIRED but are NOT listed in the CFAI list>>> Leave them EXPIRED in 123signup. But be ready to upgrade them when they are upgraded in CFAI
SELECT
onetwothree.`name`,
onetwothree.`email`, onetwothree.`exp_date`, onetwothree.`days_due`
FROM from_123 onetwothree
LEFT JOIN from_cfai cfai
ON cfai.email = onetwothree.email
@wenbert
wenbert / expired_in_123signup_and_in_cfai.sql
Created December 2, 2011 11:22
3. All those in the 123signup list who are listed as EXPIRED but are listed in the CFAI list>>> Upgrade their status in 123signup to REGULAR exp 07-2012
SELECT
onetwothree.`name`,
cfai.first_name,
cfai.last_name,
onetwothree.`email`, onetwothree.`exp_date`, onetwothree.`days_due`
FROM from_123 onetwothree
INNER JOIN from_cfai cfai ON cfai.email = onetwothree.email
@wenbert
wenbert / in_cfai_not_in_123signup.sql
Created December 2, 2011 11:07
2. All those in the CFAI list but NOT in the 123signup list>> Add them as a regular (or affiliate) SCFAS member in 123signup
SELECT
cfai.display_name, cfai.first_name, cfai.last_name, cfai.email
FROM
from_cfai cfai
WHERE cfai.email NOT IN (
SELECT onetwothree.email
FROM
from_123 onetwothree
<div id="container">
<input type="hidden" id="var" value="wenbert"/>
<input type="button" id="thebutton" value="Click"/>
</div>
<script type="text/javascript">
$(document).ready(function() {
<script type="text/javascript">
$(document).ready(function() {
$("#thebutton").click(function(){
call_ajax1();
from django.db import models
from datetime import datetime
from django.contrib.auth.models import Group, User
class Category(models.Model):
"""
class Car(models.Model):
company_that_makes_it = models.ForeignKey(Manufacturer)
# ...
"""