Class: Notes::CopyService
- Inherits:
-
Object
- Object
- Notes::CopyService
- Defined in:
- app/services/notes/copy_service.rb
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(current_user, from_noteable, to_noteable) ⇒ CopyService
constructor
A new instance of CopyService.
Constructor Details
#initialize(current_user, from_noteable, to_noteable) ⇒ CopyService
Returns a new instance of CopyService.
9 10 11 12 13 14 15 16 17 |
# File 'app/services/notes/copy_service.rb', line 9 def initialize(current_user, from_noteable, to_noteable) raise ArgumentError, 'Noteables must be different' if from_noteable == to_noteable @current_user = current_user @from_noteable = from_noteable @to_noteable = to_noteable @from_project = from_noteable.project @new_discussion_ids = {} end |
Instance Method Details
#execute ⇒ Object
19 20 21 22 23 24 25 |
# File 'app/services/notes/copy_service.rb', line 19 def execute from_noteable.notes_with_associations.find_each do |note| copy_note(note) end ServiceResponse.success end |