This commit is contained in:
albert
2010-08-18 18:44:18 -04:00
parent 5610731b35
commit 694b6f0813
13 changed files with 1018 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
class RemovedPost < ActiveRecord::Base
module RemovalMethods
def unremove!
Post.transaction do
execute_sql("INSERT INTO posts (#{Post.column_names.join(', ')}) SELECT #{Post.column_names.join(', ')} FROM removed_posts WHERE id = #{id}")
execute_sql("DELETE FROM removed_posts WHERE id = #{id}")
end
end
end
include Post::FileMethods
include Post::ImageMethods
include Post::TagMethods
include Post::SearchMethods
include Post::UploaderMethods
include Post::PoolMethods
include Post::CountMethods
include Post::CacheMethods
include RemovalMethods
end