#57 ✓resolved
Yurii Rashkovskii

Enforce associations (and may be coercion/validation) definitions

Reported by Yurii Rashkovskii | May 22nd, 2008 @ 06:03 PM | in 0.0.3

There seems to be a problem with associations at least (on second console load):

User = Meta.new do
     has_many :items
end
    # ==> User
Item = Meta.new
    # ==> Item
User.document
User.document
StrokeDB::InvalidViewError: #map method is not defined for a view !
	from /Users/yrashk/Development/idbns/strokedb/lib/strokedb/views/view.rb:251:in `map'
	from /Users/yrashk/Development/idbns/strokedb/lib/strokedb/views/view.rb:236:in `map_with_encoding'
	from /Users/yrashk/Development/idbns/strokedb/lib/strokedb/views/view.rb:221:in `update_head'
	from /Users/yrashk/Development/idbns/strokedb/lib/strokedb/views/view.rb:195:in `update'
	from /Users/yrashk/Development/idbns/strokedb/lib/strokedb/views/store_ext.rb:26:in `update_views!'
	from /opt/local/lib/ruby/1.8/set.rb:189:in `each'
	from /opt/local/lib/ruby/1.8/set.rb:189:in `each_key'
	from /opt/local/lib/ruby/1.8/set.rb:189:in `each'
	from /Users/yrashk/Development/idbns/strokedb/lib/strokedb/views/store_ext.rb:25:in `update_views!'
	from /Users/yrashk/Development/idbns/strokedb/lib/strokedb/views/store_ext.rb:46:in `update_views!'
	from /Users/yrashk/Development/idbns/strokedb/lib/strokedb/store.rb:41:in `save!'
	from /Users/yrashk/Development/idbns/strokedb/lib/strokedb/document.rb:429:in `save!'
	from /Users/yrashk/Development/idbns/strokedb/lib/strokedb/document.rb:448:in `update_slots!'
	from /Users/yrashk/Development/idbns/strokedb/lib/strokedb/document/meta.rb:133:in `named'
	from /Users/yrashk/Development/idbns/strokedb/lib/strokedb/document/dsl/associations.rb:105:in `has_many'
	from /Users/yrashk/Development/idbns/strokedb/lib/strokedb/document/meta.rb:267:in `call'
	from /Users/yrashk/Development/idbns/strokedb/lib/strokedb/document/meta.rb:267:in `make_document'
	from /Users/yrashk/Development/idbns/strokedb/lib/strokedb/document/meta.rb:267:in `each'
	from /Users/yrashk/Development/idbns/strokedb/lib/strokedb/document/meta.rb:267:in `make_document'
	from /Users/yrashk/Development/idbns/strokedb/lib/strokedb/document/meta.rb:251:in `document'
	from /Users/yrashk/Development/idbns/strokedb/lib/strokedb/document/meta.rb:249:in `map'
	from /Users/yrashk/Development/idbns/strokedb/lib/strokedb/document/meta.rb:249:in `document'
	from (irb):5
1
    # ==> 1
u = find "080f0484-32f8-4dd4-b087-c3c053fdc9f2"
    # ==> #<User name: "Yurii", uuid: "080f0484-32f8-4dd4-b087-c3c053fdc9f2", version: 0000...>
u.items
StrokeDB::SlotNotFoundError: StrokeDB::SlotNotFoundError
	from /Users/yrashk/Development/idbns/strokedb/lib/strokedb/document.rb:593:in `method_missing'
	from (irb):9

Comments and changes to this ticket

  • Yurii Rashkovskii

    Yurii Rashkovskii May 22nd, 2008 @ 06:53 PM

    Uhmm...

    StrokeDB 0.0.2.1 (help! for more info)
    clear!
        # ==> "Database has been wiped out."
    User = Meta.new { has_many :items }
        # ==> User
    Item = Meta.new
        # ==> Item
    User.document
        # ==> #<Meta has_many_items: #<View conditions: nil, expected_meta: "Item", expected_nsurl: "", extend_with: nil, key_size: nil, nsurl: "http://strokedb.com/", reference_slotname: "user", reverse: false, sort_by: nil, strategy: "heads", through: [], uuid: "e628595d-326c-5dff-a578-575662606d67", value_size: 16, version: 0000...>, name: "User", nsurl: "", uuid: "85631643-fe29-596a-9670-8765d39463bf", version: 0000...>
    u = User.create :a => 1
    NoMethodError: undefined method `create' for User:Module
    	from (irb):5
    u = User.create! :a => 1
        # ==> #<User a: 1, uuid: "af1ddd12-6d74-4966-804c-a8c03d8c588d", version: 0000...>
    i = Item.create! :user => u
        # ==> #<Item user: #<User a: 1, uuid: "af1ddd12-6d74-4966-804c-a8c03d8c588d", version: 0000...>, uuid: "3784fe21-e019-4df9-ada6-03e244f96cec", version: 0000...>
    u.items
        # ==> [#<Item user: #<User a: 1, uuid: "af1ddd12-6d74-4966-804c-a8c03d8c588d", version: 0000...>, uuid: "3784fe21-e019-4df9-ada6-03e244f96cec", version: 0000...>]
    quit
    imac:strokedb(new-views) $ sc
    StrokeDB 0.0.2.1 (help! for more info)
    User = Meta.new { has_many :items }
        # ==> User
    Item = Meta.new
        # ==> Item
    User.document
    NoMethodError: undefined method `head_version' for nil:NilClass
    
  • Yurii Rashkovskii

    Yurii Rashkovskii May 22nd, 2008 @ 08:16 PM

    • State changed from “new” to “resolved”

    we had major serialization problems in storage... preliminary fix has been developed (though we still need to refactor serialization)

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

StrokeDB is an embeddable distributed document database written in Ruby

Shared Ticket Bins

People watching this ticket