Class: Thredded::MessageboardDestroyer
- Inherits:
-
Object
- Object
- Thredded::MessageboardDestroyer
- Defined in:
- app/commands/thredded/messageboard_destroyer.rb
Instance Method Summary collapse
-
#initialize(messageboard_name) ⇒ MessageboardDestroyer
constructor
A new instance of MessageboardDestroyer.
- #run ⇒ Object
Constructor Details
#initialize(messageboard_name) ⇒ MessageboardDestroyer
Returns a new instance of MessageboardDestroyer.
4 5 6 7 8 9 |
# File 'app/commands/thredded/messageboard_destroyer.rb', line 4 def initialize() @messageboard = Thredded::Messageboard.friendly.find() @connection = ActiveRecord::Base.connection rescue say "No messageboard with the name '#{}' found." end |
Instance Method Details
#run ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'app/commands/thredded/messageboard_destroyer.rb', line 11 def run return unless ActiveRecord::Base.transaction do destroy_all_lower_dependencies destroy_all_posts destroy_all_topics end end |