Setting up acts_as_paranoid
July 28th, 2007
Due to a very small amount of documentation, and the loads of outdated documentation, on how to get started, I'm going writing a quick how to. It's very quick and easy; not much to it, just make sure you are working with the most up to date svn repository before you start. Follow the steps below.
- Navigate to your rails project folder and run the following command ruby script/plugin install http://svn.techno-weenie.net/projects/plugins/acts_as_paranoid/
- Create a migration(s) for all your database tables that do not contain a deleted_at (datetime) column that you wish to use this with by running ruby script/generate migration add_deleted_at_column
- In the migration use the add_column :table_name, :column_name, :datetime syntax, and the opposite, remove_column for migrating backwards.
- Add acts_as_paranoid under the model name of all your models you wish to use this with.
- Test it out and you should be populating the field deleted_at now instead of deleting the entire row.
Sorry, comments are closed for this article.