Guest User

Untitled

a guest
Jun 19th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.97 KB | None | 0 0
  1. #My model class looks like this:
  2.  
  3. class Cache
  4. include DataMapper::Resource
  5.  
  6. property :id, Serial
  7. property :key, String
  8. property :data, Text, :lazy => false
  9. property :expires_at, DateTime
  10. end
  11.  
  12. #I can't explain this output:
  13.  
  14. irb(main):002:0> c=Cache.first
  15. => #<Cache id=1 key="a" data="b" expires_at=nil>
  16. irb(main):003:0> c.data="c"
  17. => "c"
  18. irb(main):004:0> c.save
  19. TypeError: can't convert String into Array
  20. from /usr/local/lib/ruby/gems/1.8/gems/dm-core-0.9.11/lib/dm-core/model.rb:394:in `zip'
  21. from /usr/local/lib/ruby/gems/1.8/gems/dm-core-0.9.11/lib/dm-core/model.rb:394:in `to_query'
  22. from /usr/local/lib/ruby/gems/1.8/gems/dm-core-0.9.11/lib/dm-core/resource.rb:543:in `to_query'
  23. from /usr/local/lib/ruby/gems/1.8/gems/dm-core-0.9.11/lib/dm-core/resource.rb:603:in `hookable__update_nan_before_advised'
  24. from /usr/local/lib/ruby/gems/1.8/gems/extlib-0.9.12/lib/extlib/hook.rb:299:in `update'
  25. from /usr/local/lib/ruby/gems/1.8/gems/extlib-0.9.12/lib/extlib/hook.rb:297:in `catch'
  26. from /usr/local/lib/ruby/gems/1.8/gems/extlib-0.9.12/lib/extlib/hook.rb:297:in `update'
  27. from /usr/local/lib/ruby/gems/1.8/gems/dm-core-0.9.11/lib/dm-core/resource.rb:295:in `hookable__save_nan_before_advised'
  28. from /usr/local/lib/ruby/gems/1.8/gems/extlib-0.9.12/lib/extlib/hook.rb:299:in `save'
  29. from /usr/local/lib/ruby/gems/1.8/gems/extlib-0.9.12/lib/extlib/hook.rb:297:in `catch'
  30. from /usr/local/lib/ruby/gems/1.8/gems/extlib-0.9.12/lib/extlib/hook.rb:297:in `save'
  31. from (irb):4
  32. irb(main):005:0>
Add Comment
Please, Sign In to add comment