Created
June 7, 2011 21:02
-
-
Save larsklevan/1013155 to your computer and use it in GitHub Desktop.
Rollback changes to DB during email preview
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module EmailPreview | |
class << self | |
def preview_with_rollback(*args) | |
mail = nil | |
ActiveRecord::Base.transaction do | |
mail = preview_without_rollback *args | |
raise ActiveRecord::Rollback, "Let's not and say we did" | |
end | |
end | |
alias_method_chain :preview, :rollback | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment