This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'test_helper' | |
class AllergiesControllerTest < ActionController::TestCase | |
setup do | |
@allergy = allergies(:one) | |
end | |
test "should get index" do | |
get :index | |
assert_response :success |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | |
# ... | |
""" |