It seems like the either the syntax in the documentation is incorrect or there is a bug in the new version. This works find if you remove the square brackets from the is_versioned key. ie. is_versioned :on => :version_test
On Feb 2, 3:42 pm, Leo Godin <leogodin...@gmail.com> wrote: > Hi All, > I'm trying to use DataMapper dm-is-versioned in a rails application. > Even when doing a simple test outside of rails I cannot get > the ::Versions table created. The error is always '<Model > Name>::Version must have a key to be valid. I pasted a simple test > below with a model and a ruby script to try to version the model. The > problem occurs when I try to auto_migrate!. I am using dm-core > (0.10.2) and dm-sis-versioned (0.10.2) > Any help will be appreciated. > thanks, > Leo > > chlx327> cat test.rb > require 'rubygems' > require 'dm-core' > require 'dm-is-versioned' > require 'dm-timestamps' > > DataMapper.setup(:default, 'sqlite3::memory') > DataMapper.auto_migrate! > require 'phone' > DataMapper.auto_migrate! > Phone.auto_migrate! > chlx327> > > chlx327> cat phone.rb > > class Phone > include DataMapper::Resource > > property :id, Serial > property :updated_at, DateTime > property :created_at, DateTime > property :title, String > property :version_test, Integer > > is_versioned :on => [:version_test] > end > chlx327> > chlx327> > chlx327> > chlx327> ruby test.rb > /stor/common/ruby/lib/ruby/gems/1.8/gems/dm-core-0.10.2/lib/dm-core/ > model.rb:703:in `assert_valid': Phone::Version must have a key to be > valid (DataMapper::IncompleteModelError) > from /stor/common/ruby/lib/ruby/gems/1.8/gems/dm-core-0.10.2/ > lib/dm-core/migrations.rb:1358:in `auto_migrate!' > from /stor/common/ruby/lib/ruby/gems/1.8/gems/dm-is- > versioned-0.10.2/lib/dm-is-versioned/is/versioned.rb:52:in > `__hooks_after_auto_migrate_b__0' > from /stor/common/ruby/lib/ruby/gems/1.8/gems/extlib-0.9.14/ > lib/extlib/hook.rb:253:in `execute_after_auto_migrate_bang_hook_stack' > from /stor/common/ruby/lib/ruby/gems/1.8/gems/extlib-0.9.14/ > lib/extlib/hook.rb:307:in `auto_migrate!' > from /stor/common/ruby/lib/ruby/gems/1.8/gems/extlib-0.9.14/ > lib/extlib/hook.rb:304:in `catch' > from /stor/common/ruby/lib/ruby/gems/1.8/gems/extlib-0.9.14/ > lib/extlib/hook.rb:304:in `auto_migrate!' > from test.rb:10 -- You received this message because you are subscribed to the Google Groups "DataMapper" group. To post to this group, send email to datamap...@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.