john li
2006-Mar-20 01:50 UTC
[Rails] help: acts_as_versioned setup error "undefined local variable or method ''base_class''"
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 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060320/5572910f/attachment.html
Justin Chen
2006-Mar-21 01:17 UTC
[Rails] help: acts_as_versioned setup error "undefined local variable or method ''base_class''"
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 On 3/19/06, john li <john.l.li@gmail.com> wrote:> > 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 > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060321/3d8134d6/attachment-0001.html
Steve Odom
2006-Mar-23 17:03 UTC
[Rails] help: acts_as_versioned setup error "undefined local variable or method ''base_class''"
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 On 3/20/06, Justin Chen <justin.h.chen@gmail.com> wrote:> > 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_versionedmethod). > > Any help would be appreciated. > > Thanks, > Justin > > On 3/19/06, john li <john.l.li@gmail.com> wrote: > > > 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 > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060323/4cecd933/attachment.html
Trevor Stow
2006-Aug-13 02:47 UTC
[Rails] help: acts_as_versioned setup error "undefined local variable or method ''base_class''"
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 On 3/23/06, Steve Odom <steve.odom@gmail.com> wrote:> > 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 > > > On 3/20/06, Justin Chen <justin.h.chen@gmail.com> wrote: > > > > 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_versionedmethod). > > > > Any help would be appreciated. > > > > Thanks, > > Justin > > > > On 3/19/06, john li <john.l.li@gmail.com> wrote: > > > > > 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 > > > > > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060813/cf5d12e5/attachment-0001.html