Hi there - #19
Conversation
|
Hey Dan, thanks for the kind words. It is no longer necessary to declare I agree on the other points. |
|
I'm pretty sure I followed the instructions exactly but maybe I missed something. Things only started working after I added the macro method in, but now I can remove it and tests still pass.. So either the migrations still depend on it in some way or I was doing something wrong.. I can test it more thoroughly later tonight hopefully |
|
Hi folks, rake db:migrate --trace (in xxxxxxxxxxxxxxxxxxxxxxxxxx) ** Invoke db:migrate (first_time) ** Invoke environment (first_time) ** Execute environment ** Execute db:migrate ** Invoke db:schema:dump (first_time) ** Invoke environment ** Execute db:schema:dump No error but No table are created.... EDIT : >> Role::Archive Role::Archive NameError: uninitialized constant Role::Archive I am stuck in Ruby1.8.7 & Rails 2.3.10 & acts_as_archive 0.4.0 |
|
Same problem: no archive tables created! Ruby 1.9.2, Rails3.0.3 Whit "acts_as_archive" in the model class all works fine! |
|
Fixed (even if I have the devise issue too) |
|
Hi, I created config/acts_as_archive.yml with the following contents: Politician::Person:
- class: Politician::Person::Archive
table: archive_politician_persons
When I ran db:migrate nothing happened. When I added "acts_as_archive" in my model and then ran db:migrate the table was created, but it was called "archived_politician_persons" as opposed to what was specified in the yml file (i.e. "archive" without the 'd') This small problem aside, I am psyched to use your gem. Thanks for providing it! |
|
I have this problem too. Rails 2.3.11, Ruby 1.8.7, and when I run rake db:migrate I get: No migrations are created. As an interesting aside I also was forced to comment out all my class macro methods from other gems/plugins (e.g. attachment_fu's has_attachment among others) in order to get rake db:migrate to run at all (not usually the case). I am not sure where to go from here. Edit: I see now that the tables were created automatically. So only problem I had was a confusion over thinking it hadn't worked when it has, and needing to comment a bunch of class macros from other gems. |
|
The tables were created fine in development mode, but in production only one of the eight tables I have set as acts_as_archive had the archive table created. It is very strange. I don't seem to be able to get the migrations to run of the other tables to run. All are defined in the model files. The gem doesn't work at all with the YAML configuration file, so I had to delete it. |
|
Using as a plugin instead of a gem and things now work. acts_as_archive does not seem to work as a gem in production (worked in development though). |
|
Migrations works fine for me, when used as a gem ! using Rails 2.3.11, Ruby 1.8.7 |
|
Hi Winton and elmatou, ruby-1.9.2-p180 :001 > Ticket::Archive => Ticket::Archive(Table doesn't exist) I am using Rails 3.0.10 on Ruby 1.9.2. I wonder how I can fix this. |
|
Hi, See you. |
|
Hi elmatou, Thanks a lot for your answer. I run gem list and saw acts_as_archive (0.4.0) there. I did create yml file in config and run rake db:migrate. It ran successfully but table is not created. I am stuck with 3.0.10 because one of the key gems I installed required it. If I create archive table manually (with all columns plus magic column), would the acts_as_archive work? Otherwise, could you please advice on how I can hack it to reconcile with 3.0.10? |
|
Hi,
My point is to check if the plugin or gem is loaded with the app when starting the server (or migration). In order to correctly migrate the database, the rake task come in the following process :
For me there is only tow possible cause, either act_as_archive is not loaded along with the app, either the yaml file is not at the right place. bye |
|
Hi elmatou, Thanks a lot for your help. I have been trying to install it for 2 days now. I just reverse my installation and have a clean install using your fork to avoid conflict with Devise: kidville:rails plugin install git://github.com/elmatou/acts_as_archive.git --force
I add gem 'also_migrate' to Gemfile and run kidville:gem install also_migrate
kidville:rake db:migrate
I added gem 'mover' to Gemfile and run plugin install again. Now install is successful. I created acts_as_archive.yml in config, specify acts_as_archive in the model and run rake db:migrate. It ran through silently but did not create table. It seems to me that acts_as_archive doesn't load this time:
Since I already asked a lot, I spend the whole day trying to reinstall and figure out. It seems that I need some guidance from you again to figure out dependencies in order to get acts_as_archive load correctly. Thanks again. |
|
P/S: when I add to environment.rb: require "acts_as_archive/adapters/rails#{Rails.version[0..0]}" if defined?(Rails) and run rake db:migrate, I got the following error message: rake aborted! |
|
Hi elmatou, After restart my Terminal, I got back to the same place where I started my question yesterday: ruby-1.9.2-p180 :004 > ActsAsArchive ruby-1.9.2-p180 :005 > Ticket::Archive This means that the gem does get loaded to my app, but somehow the migration fails. (I am sure I put the yml file in config folder). Could you let me know your diagnose? |
|
A quick follow-up with elmatou:
|
|
However, when I delete rows from main table, there's no record created in archived_model. |
|
Ok, I'm not getting what's wrong with your setup. I'm gonna describe mine (Rails 2.3.11). gem 'acts_as_archive', :git => "git://github.com/elmatou/acts_as_archive.git", :branch => "ako"Here I use a branch dedicated to one of my project, it geather polymorphic association fix and manual loading of the library 2 - manual load in environment.rb (after Rails::Initializer.run block) require "acts_as_archive/adapters/rails#{Rails.version[0..0]}" if defined?(Rails)
3 - create yml file : config/acts_as_archive.yml Profil:
- class: Profil::Archive
table: archived_profils4 - Add nothing in the model OR you can try to setup the archive directly in the model (and let acts_as_archive.yml empty) class Profil < ActiveRecord
acts_as_archive :class => Profil::Archive, :table => archived_profils
end5 - 6 - load the app (avoid the rails console because it load things differently) and check if some acts_as_archive methods are present : Now, if it doesn't work, I don't know what to say... It is sad this gem is not maintaned anymore, as it is IMHO a very good soft deletion strategy (Not very suitable for heavy app, but much more easy to use as a developper). check here for other implementation : Anyhow acts_as_paranoid work also very well. Good luck with your issue |
|
Hi elmatou, It's very kind of you to give me such a detailed advice! I tried to install your version as a gem but github does not support gem anymore (although winton's version is still available for gem install as legacy), so installation was tricky. I really appreciate your help and acts_as_archive approach, but I guess I should use permanent_records for now. I'll revisit this once my site gets big enough. :-) Thanks again. |
Looks like a great gem, I was a little hazy in getting this all set up though.
It would be more clear if the readme highlighted the need to call #acts_as_archive on the respective class even though it might be obvious to some. Also highlighting the fact that migrations run without feedback would be good too.
If this differs from your experience then I apologize, it's entirely possible there is something wonky with my system.
Once again nice gem dudes
Dan