error with Rails 3.0.0 & Ruby 1.9.2 #13

axs89 opened this Issue Jan 10, 2011 · 5 comments


None yet

3 participants



I'm trying to get acts_as_archive with Rails 3.0.0 and Ruby 1.9.2. When I use gem 'acts_as_archive' in the Gemfile, and add the acts_as_archive line in my model, I get this error when trying to query the archive (I ran rake db:migrate but it didn't look like any migrations were run):

ruby-1.9.2-p0 > Shareable::Archive.first
NameError: undefined local variable or method `acts_as_archive' for #<Class:0x0000010451ce58>

Also tried to install the Gem from Github with gem 'acts_as_archive', :git => 'git://' and got this error:

`/Users/xxx/.rvm/gems/ruby-1.9.2-p0@rails3/bundler/gems/acts_as_archive-fab88766f555/lib/acts_as_archive/gems.rb:118:in `dependency_filter': undefined method `inject' for "nil":String (NoMethodError)`

I'm probably missing something simple here, but can't quite figure it out. Any help would definitely be appreciated.



Can you check if the "archived_xxx" tables were generated after rake db:migrate?

Just saying cause I am having that exact problem. I'm trying to have a look at "also_migrate"...


It seems a matter of classes, when running rake db:migrate, the model classes which require a migration, need to be loaded at some point, so that "also_migrate" can pick them up.

I tried this using a pseudo migration, empty, except for some "require 'app/models/....rb'" at the file start. And it works.


I'm pretty sure the archive tables weren't created - can't verify because unfortunately I deleted the branch. Your note regarding requiring the model classes makes sense, I was wondering how it was going to pick those up, but hadn't bothered to look into the code.


@axs89: Not sure why the gem isn't loading for you. I've been executing specs under Ruby 1.9.2 and Rails 3. I will see if I can find something for you.

@echarp: You've identified a problem with also_migrate that seems to only be solved by setting $rails_rake_task = false, which forces rake to preload all activerecord classes. I'm not sure at this point if its best to put that code in the plugin or not. Coming up with a solution to that now.


@axs89: I have tested using a fresh project, Rails 3.0.3, and Ruby 1.9.2-p136 and cannot replicate your problem of acts_as_archive not being defined. Without any more information I am closing this ticket.

@echarp: In the latest version of acts_as_archive, I have added the $rails_rake_task = false flag. Let me know if any problems arise from this.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment