I have to version something I’m working on, so I thought acts_as_versioned would be the quickest and easiest way to go. And it was… locally. I’m using the gem instead of the plugin, and the gem is frozen. Here’s the deal:
1 2 3 4 5 6 7 8 9 10 11 | # environment.rb config.load_paths += Dir["#{RAILS_ROOT}/vendor/gems/**"].map do |dir| File.directory?(lib = "#{dir}/lib") ? lib : dir end # some_class.rb class SomeClass < ActiveRecord::Base acts_as_versioned non_versioned_fields.push "field_one", "field_two" ... end |
I don’t think it has anything to do with the gem not being loaded, as I’ve never had a problem adding lib directories to the load path before. However, I get an error (in production) similar to:
LoadError (Expected ../config/../app/models/some_class.rb to define SomeClass): ...
I can find bits and pieces of this error floating around in Google results, but nothing (suggested) is working for me. After troubleshooting this as long as I have been, part of me thinks writing my own versioning code would have been easier.
FYI: the class loads fine without the acts_as_versioned declaration.
UPDATE: I changed from the gem to the plugin, and it’s working fine now. I already had the gem, so I just unpacked it to save 2 seconds of typing, which ended up costing me nearly 2 hours of troubleshooting.