winton / acts_as_archive

Don't delete your records, move them to a different table
MIT License
372 stars 87 forks source link

Possible issue with loading from yaml file #28

Open foresth opened 13 years ago

foresth commented 13 years ago

Hello, I was trying to find out why rake db:migrate wouldn't create any new tables even though I had the yaml config file specified correctly.

I found out you are trying to evaluate the model name (e.g. Article) in the load_from_yaml method during rails initialization and if something fails you rescue it with nil. The problem is you might have e.g. some actsas* statements in the affected model that hasn't been met yet. E.g. you utilize an acts_as_train plugin in the model but the plugin hasn't been loaded so in the "klass = eval(klass) rescue nil" statement you get an undefined method 'acts_as_train' error which results in nil.

If I install acts_as_archived as plugin and set the plugin load order to [:all, :acts_as_archived], it starts working.