Skip to content

Instantly share code, notes, and snippets.

const Post:Model = new Model("post");
var request:Request = Post.findAll();
request.onComplete(function(posts:*):void {
posts.forEach(function(post:*, index:int, array:Array):void {
Alert.show(post.subject);
});
});
request.onError(function():void {
Alert("Darn");
namespace :db do
desc "Perform automigration"
task :automigrate => :environment do
::DataMapper::AutoMigrator.auto_migrate
end
desc "Perform non destructive automigration"
task :autoupgrade => :environment do
::DataMapper::AutoMigrator.auto_upgrade
clj hello.clj
Exception in thread "main" java.lang.IllegalArgumentException: Don't know how to create ISeq from: Symbol (str_utils.clj:0)
at clojure.lang.Compiler.eval(Compiler.java:4153)
at clojure.lang.Compiler.load(Compiler.java:4470)
at clojure.lang.RT.loadResourceScript(RT.java:327)
at clojure.lang.RT.loadResourceScript(RT.java:316)
at clojure.lang.RT.load(RT.java:406)
at clojure.lang.RT.load(RT.java:376)
at clojure.core$load__4557$fn__4559.invoke(core.clj:3427)
at clojure.core$load__4557.doInvoke(core.clj:3426)
$ cat ~/bin/clj
#!/bin/bash
# Runs Clojure using the classpath specified in the `.clojure` file of the
# current directory.
#
# Mark Reid <http://mark.reid.name>
# CREATED: 2009-03-29
JAVA=/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home/bin/java
CONTRIB=$CLJ_DIR/clojure-contrib.jar
CP=$PWD:$CONTRIB
(use 'compojure)
(defroutes my-app
(GET "/"
(html [:h1 "Hello World"]))
(ANY "*"
(page-not-found)))
(run-server {:port 8080}
lance-carlsons-macbook-pro:clojure lancelotcarlson$ ant
Buildfile: build.xml
init:
compile_java:
compile_clojure:
[java] Compiling clojure.core to /Users/lancelotcarlson/src/clojure/classes
[java] Compiling clojure.main to /Users/lancelotcarlson/src/clojure/classes
Single Table Inheritance
#<DataMapper::Query::Conditions::AndOperation:0x163ffdc @operands=#<Set: {#<DataMapper::Query::Conditions::EqualToComparison @subject=#<DataMapper::Property @model=Person @name=:id> @dumped_value=4b44547c7d209c280e000001 @loaded_value="4b44547c7d209c280e000001">}>>
#<DataMapper::Query::Conditions::AndOperation:0x163463c @operands=#<Set: {#<DataMapper::Query::Conditions::EqualToComparison @subject=#<DataMapper::Property @model=Person @name=:id> @dumped_value=4b44547c7d209c280e000002 @loaded_value="4b44547c7d209c280e000002">}>>
#<DataMapper::Query::Conditions::AndOperation:0x1628cc4 @operands=#<Set: {#<DataMapper::Query::Conditions::EqualToComparison @subject=#<DataMapper::Property @model=Person @name=:id> @dumped_value=4b44547c7d209c280e000003 @loaded_value="4b44547c7d209c280e000003">}>>
#<DataMapper::Query::Conditions::AndOperation:0x161d34c @operands=#<Set: {#<DataMapper::Query::Conditions::EqualToComparison @subject=#<DataMapper::Property @model=Person @name=:id> @dumped_value=4b445
require File.join(File.dirname(__FILE__), 'spec_helper')
describe "Single Table Inheritance" do
before(:all) do
cleanup_models :Person, :Male, :Father, :Son
$db.drop_collection('people')
class ::Person
include DataMapper::Mongo::Resource
Single Table Inheritance
READ
"(id = 4b44589b7d209c282d000001)"
READ
"(id = 4b44589b7d209c282d000002)"
READ
"(id = 4b44589b7d209c282d000003)"
READ
"(id = 4b44589b7d209c282d000004)"
- should have a type property that reflects the class
1)
NoMethodError in 'Single Table Inheritance should have a type property that reflects the class'
undefined method `key' for "Person":String
/Users/lancelotcarlson/.rvm/gems/ruby/1.8.7/gems/dm-core-0.10.3/lib/dm-core/model.rb:494:in `load'
/Users/lancelotcarlson/.rvm/gems/ruby/1.8.7/gems/dm-core-0.10.3/lib/dm-core/model.rb:482:in `map'
/Users/lancelotcarlson/.rvm/gems/ruby/1.8.7/gems/dm-core-0.10.3/lib/dm-core/model.rb:482:in `load'
/Users/lancelotcarlson/.rvm/gems/ruby/1.8.7/gems/dm-core-0.10.3/lib/dm-core/repository.rb:145:in `read'
/Users/lancelotcarlson/.rvm/gems/ruby/1.8.7/gems/dm-core-0.10.3/lib/dm-core/collection.rb:1111:in `lazy_load'
/Users/lancelotcarlson/.rvm/gems/ruby/1.8.7/gems/extlib-0.9.14/lib/extlib/lazy_array.rb:409:in `each'
/Users/lancelotcarlson/.rvm/gems/ruby/1.8.7/gems/dm-core-0.10.3/lib/dm-core/collection.rb:506:in `each'