[Nitro] many_to_many delete bug

George Moschovitis george.moschovitis at gmail.com
Thu Nov 15 07:00:13 EST 2007


I will fix this (it is a showstopper for my current application too!!)

-g.

On Nov 14, 2007 3:59 PM, Robert Mela <rob at robmela.com> wrote:

> Just for reference -- the other showstopper is in
> http://rubyforge.org/pipermail/nitro-general/2007-November/008957.html
>
> The new issue is delete in a many_to_many relation:
>
> robert-melas-computer:~/projects/og rmela$ ruby tagtest.rb  INFO: Og
> uses the Sqlite store.
> Program inserting tag1
> Collection#initialize: Collection initialized with remove_proc =
> remove_tag
> Created tags collection with remove proc=remove_tags
> Collection#push Entered Collection.push(tag1) with tag=tag1.  Owner is
> #<Post:0x15911e4>
> Program calling save
> Deleting tag
> /Users/rmela/nitro/branch/script/lib/../../og/lib/og/store/sql.rb:144:in
> `og_delete': uninitialized constant Og::SqlEnchantmentMixin::BelongsTo
> (NameError)
>        from
> /Users/rmela/nitro/branch/script/lib/../../og/lib/og/store/sql.rb:139:in
> `each'
>        from
> /Users/rmela/nitro/branch/script/lib/../../og/lib/og/store/sql.rb:139:in
> `og_delete'
>        from
> /Users/rmela/nitro/branch/script/lib/../../og/lib/og/store.rb:216:in
> `transaction_raise'
>        from
> /Users/rmela/nitro/branch/script/lib/../../og/lib/og/model.rb:196:in
> `transaction_raise'
>        from
> /Users/rmela/nitro/branch/script/lib/../../og/lib/og/manager.rb:118:in
> `with_store'
>        from
> /Users/rmela/nitro/branch/script/lib/../../og/lib/og/model.rb:195:in
> `transaction_raise'
>        from
> /Users/rmela/nitro/branch/script/lib/../../og/lib/og/store/sql.rb:137:in
> `og_delete'
>        from
> /Users/rmela/nitro/branch/script/lib/../../og/lib/og/store.rb:153:in
> `delete'
>        from
> /Users/rmela/nitro/branch/script/lib/../../og/lib/og/model.rb:181:in
> `delete'
>        from
> /Users/rmela/nitro/branch/script/lib/../../og/lib/og/manager.rb:118:in
> `with_store'
>        from
> /Users/rmela/nitro/branch/script/lib/../../og/lib/og/model.rb:180:in
> `delete'
>        from tagtest.rb:31
>
>
> Here's code that triggers it.   I tried p.remove_tag(t1) and p.save!
> before the delete -- still no dice.   Even if that did work it'd be a
> workaround, and unintuitive.
>
> #!/opt/local/bin/ruby
> require 'og'
> require 'sqlite3'
>
> class Post
> attr_accessor :name, String
> is Taggable
> end
>
> Og.start(
> :adapter => 'sqlite',
> :name => 'tagtest',
> :destroy_schema => true,
> :create_schema => true
> )
> p=Post.new
> p.name = 'post1'
> t1 = Tag.new
> t1.name = 'tag1'
>
> puts "Program inserting tag1"
> p.tags <<  t1
> puts "Program calling save"
> p.save!
> puts "Deleting tag"
> t1.delete
>
>
>
>
> _______________________________________________
> Nitro-general mailing list
> Nitro-general at rubyforge.org
> http://rubyforge.org/mailman/listinfo/nitro-general
>



-- 
http://me.gr
http://joy.gr
http://cull.gr
http://nitroproject.org
http://phidz.com
http://joyerz.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/nitro-general/attachments/20071115/d73dd88a/attachment-0001.html 


More information about the Nitro-general mailing list