Ruby Forum Nitro > Og NameError

Posted by Matthew B Gardner (Guest)
on 27.12.2007 14:42
(Received via mailing list)
Caught NameError: undefined local variable or method `attributes' for
YAML::YPath:Class
        /usr/lib/ruby/gems/1.8/gems/og-0.50.0/lib/og/util/ann_attr.rb:51:in
`serializable_attributes'
        /usr/lib/ruby/gems/1.8/gems/og-0.50.0/lib/og/manager.rb:192:in
`manageable?'
        /usr/lib/ruby/gems/1.8/gems/og-0.50.0/lib/og/manager.rb:222:in
`manageable_classes'
        /usr/lib/ruby/gems/1.8/gems/og-0.50.0/lib/og/manager.rb:218:in
`manageable_classes'
        /usr/lib/ruby/gems/1.8/gems/og-0.50.0/lib/og/manager.rb:239:in
`manage_classes'
        /usr/lib/ruby/gems/1.8/gems/og-0.50.0/lib/og/main.rb:192:in 
`setup'

-Matt
Posted by Trans (Guest)
on 28.12.2007 06:25
(Received via mailing list)
On Dec 27, 8:32 am, Matthew B Gardner <weat...@speakeasy.net> wrote:
>         /usr/lib/ruby/gems/1.8/gems/og-0.50.0/lib/og/manager.rb:239:in
> `manage_classes'
>         /usr/lib/ruby/gems/1.8/gems/og-0.50.0/lib/og/main.rb:192:in `setup'

I though I already fixed this, but maybe George hasn't had the chance
to apply the patch. The solution is simply that #attributes should be
#instance_attributes.

T.
Posted by Matthew B Gardner (Guest)
on 28.12.2007 12:21
(Received via mailing list)
Hello --

On Thursday 27 December 2007 23:47, Trans wrote:
> >         /usr/lib/ruby/gems/1.8/gems/og-0.50.0/lib/og/manager.rb:218:in
> T.
Thanks for the reply -- I fixed the issue there and then another that 
popped
up in sql.rb as well. However, more problems arose once I got my 
application
running -- searching for data in a table was giving incorrect results 
and
saving an object was trying to save it to its parent's table. Also, the
parent table had fields which it shouldn't have...fields declared only 
in
another child (not the same child that I encountered the saving problem
with). Are these problems related to the pending patch?

Thanks again,
Matt
Posted by Jonathan Buch (Guest)
on 28.12.2007 15:30
(Received via mailing list)
Hi,

[...]
> saving an object was trying to save it to its parent's table. Also, the
> parent table had fields which it shouldn't have...fields declared only in
> another child (not the same child that I encountered the saving problem
> with). Are these problems related to the pending patch?

if you are using STI (single table inheritance, `is 
SingleTableInherited`
I think it is now), that is the correct behaviour.
If not, it's a bug.

Jo
Posted by Matthew B Gardner (Guest)
on 05.01.2008 07:33
(Received via mailing list)
Hello --

> Thanks for the reply -- I fixed the issue there and then another that
> popped up in sql.rb as well. However, more problems arose once I got my
> application running -- searching for data in a table was giving incorrect
> results and saving an object was trying to save it to its parent's table.
> Also, the parent table had fields which it shouldn't have...fields declared
> only in another child (not the same child that I encountered the saving
> problem with). Are these problems related to the pending patch?
>

I'm still encountering the above issues, although I'm also dealing with 
more
issues now. I deleted my tables to see if Og just needed to rebuild
them...that didn't work and actually created more problems. RootObject 
is a
parent of Account, but RootObject is adding and deleting Account's 
columns
and an Account table isn't being created at all. Character is also a 
child of
RootObject and RootObject is taking two of the columns in Character as 
its
own. Here's a printout -- none of the columns printed should be part of
RootObject:

INFO: Created table `ogrootobject`.
 INFO: Adding field 'its_id' to '`ogrootobject`'
 INFO: Adding field 'its_update' to '`ogrootobject`'
 INFO: Adding field 'bts_id' to '`ogrootobject`'
 INFO: Adding field 'bts_update' to '`ogrootobject`'
 INFO: Adding field 'logins' to '`ogrootobject`'
 INFO: Adding field 'type' to '`ogrootobject`'
 INFO: Adding field 'password' to '`ogrootobject`'
 INFO: Adding field 'created_host' to '`ogrootobject`'
 INFO: Adding field 'last_host' to '`ogrootobject`'
 INFO: Adding field 'color' to '`ogrootobject`'
 INFO: Adding field 'hints' to '`ogrootobject`'
 INFO: Adding field 'linemode' to '`ogrootobject`'
 INFO: Adding field 'compact' to '`ogrootobject`'
 INFO: Adding field 'pagebreak' to '`ogrootobject`'
 INFO: Removing field 'pagebreak' from '`ogrootobject`'
 INFO: Removing field 'logins' from '`ogrootobject`'
 INFO: Removing field 'created_host' from '`ogrootobject`'
 INFO: Removing field 'compact' from '`ogrootobject`'
 INFO: Removing field 'type' from '`ogrootobject`'
 INFO: Removing field 'its_id' from '`ogrootobject`'
 INFO: Removing field 'last_host' from '`ogrootobject`'
 INFO: Removing field 'its_update' from '`ogrootobject`'
 INFO: Removing field 'hints' from '`ogrootobject`'
 INFO: Removing field 'password' from '`ogrootobject`'
 INFO: Removing field 'bts_id' from '`ogrootobject`'
 INFO: Removing field 'linemode' from '`ogrootobject`'
 INFO: Removing field 'color' from '`ogrootobject`'
 INFO: Removing field 'bts_update' from '`ogrootobject`'
 INFO: Adding field 'aliases' to '`ogrootobject`'
 INFO: Adding field 'account_oid' to '`ogrootobject`'

Does this point to something I should be doing that I'm not? My 
application is
pretty much paralyzed until I get this issue fixed, so any help is very 
much
appreciated.

Thanks,
Matt
Posted by Jonathan Buch (Guest)
on 06.01.2008 12:35
(Received via mailing list)
Hi,

> Does this point to something I should be doing that I'm not? My  
> application is pretty much paralyzed until I get this issue
> fixed, so any help is very much appreciated.

like I wrote before, if you are using STI, this is the correct
behaviour.

That it dropps fields, tells me that you must be using
`:evolve_schema => :full`, which hmm.. might not be good with STI.

If you don't use STI, it's a bug and Trans should fix it.  :P

class Model1
   attr_accessor :chunky, String
end
class Model2 < Model1
   attr_accessor :bacon, String
end
Og.start
Model2.table # => 'ogmodel2'

If this prints ogmodel1, there's a bug.  The other Og guys here
should fix it.  :P

Jo