Skip to content

Commit

Permalink
add some docs for destroy! and delete_all!
Browse files Browse the repository at this point in the history
  • Loading branch information
look committed Feb 26, 2010
1 parent bd8481d commit 508fc5a
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
17 changes: 16 additions & 1 deletion README.markdown
Expand Up @@ -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>
16 changes: 15 additions & 1 deletion spec/acts_as_archive/base/destroy_spec.rb
Expand Up @@ -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

Expand Down Expand Up @@ -100,4 +114,4 @@
end
end
end
end
end

0 comments on commit 508fc5a

Please sign in to comment.