Skip to content
Browse files

add some docs for destroy! and delete_all!

  • Loading branch information...
1 parent bd8481d commit 508fc5aec29368af85d95929dc2769bfc89b7732 @look committed Feb 25, 2010
Showing with 31 additions and 2 deletions.
  1. +16 −1 README.markdown
  2. +15 −1 spec/acts_as_archive/base/destroy_spec.rb
View
17 README.markdown
@@ -101,4 +101,19 @@ end
</pre>
Call <code>ActsAsArchive.update</code> upon adding new indexes
-(see <a href="#create_archive_tables">_Create archive tables_</a>).
+(see <a href="#create_archive_tables">_Create archive tables_</a>).
+
+Delete records without archiving
+--------------------------------
+
+To destroy a record without archiving it, use:
+
+<pre>
+article.destroy!
+</pre>
+
+To delete records without archiving, use:
+
+<pre>
+Article.delete_all!(["id in (?)", [1,2,3]])
+</pre>
View
16 spec/acts_as_archive/base/destroy_spec.rb
@@ -20,6 +20,20 @@
end
end
+
+ describe 'destroy!' do
+
+ before(:all) do
+ create_records
+ @article = Article.first
+ end
+
+ it "should really destroy a records" do
+ @article.destroy!
+ Article::Archive.count.should == 0
+ end
+
+ end
describe 'delete_all' do
@@ -100,4 +114,4 @@
end
end
end
-end
+end

0 comments on commit 508fc5a

Please sign in to comment.
Something went wrong with that request. Please try again.