[Nitro] Problems...
Jeff Wood
jeff.darklight at gmail.com
Sun Aug 28 10:55:45 EDT 2005
George Moschovitis wrote:
>Hello,
>
>either define tour classes *before* Og.setup or call og.manage_classes
>after you define them.
>
>-g.
>
>On 8/27/05, Jeff Wood <jeff.darklight at gmail.com> wrote:
>
>
>>Ok,
>>
>>I have Nitro & SQLite3 both setup as rubygems on my system.
>>
>>I'm trying to run the following through irb.
>>
>>--SCRIPT--
>>require 'rubygems'
>>require 'sqlite3'
>>require 'og'
>>
>>db = Og.setup( :store => :sqlite, :database => 'blah.db' )
>>
>>class User
>> property :name, String
>> property :pass, String
>> property :age, Fixnum
>> has_many :comments, Comment
>>end
>>
>>class Comment
>> property :title, String
>> property :body, String
>> belongs_to :owner, User
>>end
>>
>>a = User.new
>>a.name = "joe blow"
>>a.pass = "shhh"
>>a.age = 13
>>
>>b = Comment.new
>>b.title = "Comment #1"
>>b.body = "testing 1 2 3"
>>
>>a.comments << b
>>--SCRIPT--
>>
>>And at the comments << b line it blows up saying that there is no
>>comments method for User.
>>
>>What am I doing wrong?
>>
>>j.
>>
>>--
>>"So long, and thanks for all the fish"
>>
>>Jeff Wood
>>
>>_______________________________________________
>>Nitro-general mailing list
>>Nitro-general at rubyforge.org
>>http://rubyforge.org/mailman/listinfo/nitro-general
>>
>>
>>
>
>
>
>
I played a bit more with my script ... and it seems that the magical
goodness of Og redefining tables doesn't work for sqlite ... so, when I
blew away the sample database, it recreated things and it seems to work now.
I think you should add some kind of an easy to read error message that
the class definitions don't match up with the database model, and that
the database model is not alterable ( as easily ) in sqlite
Anyways, thanks for your help.
Oh, also, I was trying to follow the example where you use User[ 'value
from name field' ] and it doesn't seem to like that ... yet another
incompatibility with sqlite?
Thanks again.
j.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/nitro-general/attachments/20050828/5865e06e/attachment.html
More information about the Nitro-general
mailing list