Forum: Ruby on Rails help: acts_as_versioned setup error "undefined local variabl

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
B7f2e528657f046f559aaf8a79756a14?d=identicon&s=25 john li (Guest)
on 2006-03-20 02:50
(Received via mailing list)
Hi All,

Rails newbie here trying to set up acts_as_versioned according to
Chapter 14
in the Rails Recipies book.  I've taken the following steps (nearly
verbatim) as mentioned by the book:
- created the target model "Post"
- added the "acts_as_versioned" label to the model file
- generated a migration file
- added the table creation code and the command
"Post.create_versioned_table"
to the migration file
- ran "rake migrate"

What I got is the error "undefined local variable or method 'base_class'
for
Post:Class".  I tried with other models and kept getting the same error.
It
seems like "rake migrate" is missing the right environment setup, and
thus
can't find the Post class defined in the model file.  Is there some step
I've overlooked?

Thanks a ton,
John

http://www.twobitoperation.com
291ce712bdd6aa97abad3b693ca045d1?d=identicon&s=25 Justin Chen (Guest)
on 2006-03-21 02:17
(Received via mailing list)
I'm having the same problem.  I then tried renaming all my rake files to
make sure I didnt have any tasks that might be interferring with the
environment load.  I think that helped me get a little further since it
now
dies on the "create_versioned_table" call.  It also seems that the
acts_as_versioned method isn't being called even though I have it at the
top
of my model file.  It looks like "create_versioned_table" dies because
the
"versioned_table_name" (which is set in the main acts_as_versioned
method).

Any help would be appreciated.

Thanks,
Justin
E98de78bb42013c488fe8aa9d77d2cb1?d=identicon&s=25 Steve Odom (Guest)
on 2006-03-23 18:03
(Received via mailing list)
Has there been any progress on this? I'm having a similar problem
running my
rake migration for creating my versioned_table.

Steve
http://www.smarkets.net
Ccd45152acdb5a27b43728a1c67faf57?d=identicon&s=25 Trevor Stow (Guest)
on 2006-08-15 14:18
(Received via mailing list)
I've been harassed by this problem, but not consistently.  I think,
however,
that I've found a possible cause.

If you're running emacs or some other development environement where you
could have multiple buffers open, some buffers may not be fresh views of
what's actually on disk.  If you run script/generate migrate <your table
name> or script/generate model <your table name> ...

... then you might have overwritten you model file, especially if you
just
hit enter whenever prompted.  So that acts_as_versioned you see in your
code
might not be there.
Hope this saves someone the hour I just spent kicking every tire in my
code
before I finally found this.
Trevor
This topic is locked and can not be replied to.