Metas without constant
Reported by Oleg Andreev | April 30th, 2008 @ 12:12 AM | in 0.0.3
Meta.new :name=>"SomeName" should not produce a SomeName constant.
With current implementation based on UUIDv5 it might be easy to fix.
Comments and changes to this ticket
-
Yurii Rashkovskii April 30th, 2008 @ 12:30 AM
That will mean that I will not be able to lookup meta definition block (unless I will cache it per meta). Should I cache it (like I do for views)?
-
Yurii Rashkovskii April 30th, 2008 @ 07:10 AM
- → State changed from new to open
-
Yurii Rashkovskii April 30th, 2008 @ 08:19 AM
While I do not like those metas without constants, I managed to get it working (though with implication of some code spots, so we'll need more refactoring):
Meta.new(:name => "User", :nsurl => 'a') { def ping; 'pong' ; end } # ==> User usermeta = _ # ==> User u = usermeta.create! :a => "1" # ==> #<User a: "1", uuid: "64b1b028-4e9b-47d1-aa95-616f77756d06", version: 0000...> u.ping # ==> "pong" u.reload.ping # ==> "pong" User NameError: uninitialized constant User from (irb):7I still doubt we should allow this way of meta definition — it complicates things, I think.
-
Yurii Rashkovskii April 30th, 2008 @ 08:20 AM
- → State changed from open to resolved
(from [591e7fe8a219f16de2f3428dc01950a67c231e90]) Metas without constant initial implementation [#30 state:resolved]
Please Login or create a free account to add a new comment.
You can update this ticket by sending an email to from your email client. (help)
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
