Created
October 23, 2008 15:03
-
-
Save eltiare/19051 to your computer and use it in GitHub Desktop.
This file contains 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 Ad | |
include DataMapper::Resource | |
property :id, Integer, :serial => true | |
has n, :counties, :class_name => 'Ads::Counties', :child_key => [:ad_id], :parent_key => [:id] | |
end | |
module Ads | |
class Counties | |
include DataMapper::Resource | |
property :id, Serial | |
property :ad_id, Integer, :index => true | |
property :county_name, String, :index => true | |
belongs_to :ad, :class_name => 'Ad', :child_key => [:ad_id] | |
end | |
end # Ads | |
Here is the error trace: | |
NoMethodError: undefined method `counties_association' for #<Ads::Counties id=1 ad_id=1 county_name=nil> | |
from /opt/local/lib/ruby/gems/1.8/gems/dm-core-0.9.6/lib/dm-core/associations/relationship.rb:153:in `send' | |
from /opt/local/lib/ruby/gems/1.8/gems/dm-core-0.9.6/lib/dm-core/associations/relationship.rb:153:in `get_parent' | |
from /opt/local/lib/ruby/gems/1.8/gems/dm-core-0.9.6/lib/dm-core/associations/relationship.rb:152:in `each' | |
from /opt/local/lib/ruby/gems/1.8/gems/dm-core-0.9.6/lib/dm-core/associations/relationship.rb:152:in `get_parent' | |
from /opt/local/lib/ruby/gems/1.8/gems/dm-core-0.9.6/lib/dm-core/associations/relationship.rb:168:in `with_repository' | |
from /opt/local/lib/ruby/gems/1.8/gems/dm-core-0.9.6/lib/dm-core/support/kernel.rb:6:in `repository' | |
from /opt/local/lib/ruby/gems/1.8/gems/dm-core-0.9.6/lib/dm-core.rb:181:in `repository' | |
from /opt/local/lib/ruby/gems/1.8/gems/dm-core-0.9.6/lib/dm-core/repository.rb:44:in `scope' | |
from /opt/local/lib/ruby/gems/1.8/gems/dm-core-0.9.6/lib/dm-core.rb:181:in `repository' | |
from /opt/local/lib/ruby/gems/1.8/gems/dm-core-0.9.6/lib/dm-core/support/kernel.rb:6:in `repository' | |
from /opt/local/lib/ruby/gems/1.8/gems/dm-core-0.9.6/lib/dm-core/associations/relationship.rb:168:in `with_repository' | |
from /opt/local/lib/ruby/gems/1.8/gems/dm-core-0.9.6/lib/dm-core/associations/relationship.rb:131:in `get_parent' | |
from /opt/local/lib/ruby/gems/1.8/gems/dm-core-0.9.6/lib/dm-core/associations/relationship.rb:95:in `get_children' | |
from /opt/local/lib/ruby/gems/1.8/gems/extlib-0.9.8/lib/extlib/lazy_array.rb:14:in `each' | |
from /opt/local/lib/ruby/gems/1.8/gems/extlib-0.9.8/lib/extlib/lazy_array.rb:14:in `each' | |
from /opt/local/lib/ruby/gems/1.8/gems/dm-core-0.9.6/lib/dm-core/associations/relationship.rb:94:in `get_children' | |
... 8 levels... | |
from /opt/local/lib/ruby/gems/1.8/gems/dm-core-0.9.6/lib/dm-core/associations/one_to_many.rb:242:in `children' | |
from /opt/local/lib/ruby/gems/1.8/gems/dm-core-0.9.6/lib/dm-core/associations/one_to_many.rb:300:in `method_missing' | |
from /opt/local/lib/ruby/1.8/irb.rb:302:in `output_value' | |
from /opt/local/lib/ruby/1.8/irb.rb:151:in `eval_input' | |
from /opt/local/lib/ruby/1.8/irb.rb:263:in `signal_status' | |
from /opt/local/lib/ruby/1.8/irb.rb:147:in `eval_input' | |
from /opt/local/lib/ruby/1.8/irb.rb:146:in `eval_input' | |
from /opt/local/lib/ruby/1.8/irb.rb:70:in `start' | |
from /opt/local/lib/ruby/1.8/irb.rb:69:in `catch' | |
from /opt/local/lib/ruby/1.8/irb.rb:69:in `start' | |
from /opt/local/lib/ruby/gems/1.8/gems/merb-core-0.9.7/lib/merb-core/rack/adapter/irb.rb:106:in `start' | |
from /opt/local/lib/ruby/gems/1.8/gems/merb-core-0.9.7/lib/merb-core/server.rb:54:in `start' | |
from /opt/local/lib/ruby/gems/1.8/gems/merb-core-0.9.7/lib/merb-core.rb:108:in `start' | |
from /opt/local/lib/ruby/gems/1.8/gems/merb-core-0.9.7/bin/merb:11 | |
from /opt/local/bin/merb:19:in `load' | |
from /opt/local/bin/merb:19irb | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment