isTaggable bug

Actually, it’s probably a generic many_to_many bug.

Problem also exists in trunk.

#!/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’
t2 = Tag.new
t2.name = ‘tag2’

p.tags << t1
p.tags << t2
p.save

This exception thrown during save. I expect it’s likely to bring any
blog sample application crashing early. Not a good early impression!

Also of note – notice printed for ogtag and ogpost, but none for
ogj_post_tag. But that’s not important now :slight_smile:

robert-melas-computer:~/projects/og rmela$ ruby tagtest.rb
INFO: Og uses the Sqlite store.
INFO: Dropped database ‘tagtest’
INFO: Created table ogtag.
INFO: Created table ogpost.
/Users/rmela/nitro/branch/script/lib/…/…/og/lib/og/collection.rb:274:in
send': undefined methodremove’ for [#<Tag:0x15bec48 @count=0,
@name=“tag1”>]:Array (NoMethodError)
from
/Users/rmela/nitro/branch/script/lib/…/…/og/lib/og/collection.rb:274:in
method_missing' from /Users/rmela/nitro/branch/script/lib/../../og/lib/og/collection.rb:134:in<<’
from tagtest.rb:26

Hi Rob,
Not sure if this helps or sheds any light…

In evolution.rb:Evolution#evolve_schema, the method will:
return unless @options[:evolve_schema]

HTH?
Mark