Skip to content

Instantly share code, notes, and snippets.

@somebee
Created February 3, 2009 20:01
Show Gist options
  • Save somebee/57714 to your computer and use it in GitHub Desktop.
Save somebee/57714 to your computer and use it in GitHub Desktop.
class User
include DataMapper::Resource
property :id, Serial
property :name, String
end
class Event
include DataMapper::Resource
belongs_to :actor, :model => "User", :child_key => [:actor_id]
end
Event.get(1).actor =>
merb : worker (port 4000) ~ undefined method `get' for nil:NilClass - (NoMethodError)
/usr/local/lib/ruby/gems/1.8/gems/dm-core-0.10.0/lib/dm-core/associations/many_to_one.rb:83:in `actor'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment