I have a model named Fact. A fact belongs to many other models and holds some attributes. Think of it as a data-warehouse fact table.
class Fact include DataMapper::Resource belongs_to :patientposition, :key => true belongs_to :controlpointcount, :key => true belongs_to :radiationtype, :key => true belongs_to :collimatormovement, :key => true belongs_to :beamcount, :key => true belongs_to :marctype, :key => true property :valid, Boolean, :required => true, :default => true property :marctestdate_count, Integer, :required => true, :default => 0 property :realvortest1_count, Integer, :required => true, :default => 0 timestamps :at end All of the other models are described in the same way: class *Name* include DataMapper::Resource property :id, Serial property :value, String, :required => true validates_uniqueness_of :value end If I want to first_or_create a fact issuing e.g. Fact.first_or_create("patientposition_id"=>2, "controlpointcount_id"=>3, "radiationtype_id"=>1, "collimatormovement_id"=>1, "beamcount_id"=>4, "marctype_id"=>3) I get this error (which renders me helpless): *wrong number of arguments (1 for 0)* /Users/jo/.rvm/gems/ruby-1.9.3-p194@tdqmed.rails/gems/dm-core-1.2.0/lib/dm-core/model/property.rb:218:in `valid?' /Users/jo/.rvm/gems/ruby-1.9.3-p194@tdqmed.rails/gems/dm-validations-1.2.0/lib/dm-validations.rb:51:in `save_self' /Users/jo/.rvm/gems/ruby-1.9.3-p194@tdqmed.rails/gems/dm-core-1.2.0/lib/dm-core/resource.rb:1006:in `block in _save' /Users/jo/.rvm/gems/ruby-1.9.3-p194@tdqmed.rails/gems/dm-core-1.2.0/lib/dm-core/resource.rb:1222:in `run_once' /Users/jo/.rvm/gems/ruby-1.9.3-p194@tdqmed.rails/gems/dm-core-1.2.0/lib/dm-core/resource.rb:1005:in `_save' /Users/jo/.rvm/gems/ruby-1.9.3-p194@tdqmed.rails/gems/dm-core-1.2.0/lib/dm-core/resource.rb:405:in `save' /Users/jo/.rvm/gems/ruby-1.9.3-p194@tdqmed.rails/gems/dm-validations-1.2.0/lib/dm-validations.rb:40:in `block in save' /Users/jo/.rvm/gems/ruby-1.9.3-p194@tdqmed.rails/gems/dm-validations-1.2.0/lib/dm-validations/context.rb:16:in `in_context' /Users/jo/.rvm/gems/ruby-1.9.3-p194@tdqmed.rails/gems/dm-validations-1.2.0/lib/dm-validations.rb:40:in `save' /Users/jo/.rvm/gems/ruby-1.9.3-p194@tdqmed.rails/gems/dm-validations-1.2.0/lib/dm-validations.rb:130:in `create' /Users/jo/.rvm/gems/ruby-1.9.3-p194@tdqmed.rails/gems/dm-core-1.2.0/lib/dm-core/model.rb:444:in `first_or_create' This error appears whether I use the ids or the actual model instance queried from the database. Any hints or ideas? -- Johannes -- You received this message because you are subscribed to the Google Groups "DataMapper" group. To view this discussion on the web visit https://groups.google.com/d/msg/datamapper/-/RM8rfXCfCfgJ. To post to this group, send email to datamapper@googlegroups.com. To unsubscribe from this group, send email to datamapper+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/datamapper?hl=en.