= [] saved_issues = [] if @copy && params[:copy_subtasks].present? # Descendant issues will be copied with the parent task # Don't copy them twice @issues.reject! {|issue| @issues.detect {|other| issue.is_descendant_of?(other)}} end @issues.each do |orig_issue| orig_issue.reload if @copy issue = orig_issue.copy({}, :attachments => params[:copy_attachments].present?, :subtasks => params[:copy_subtasks].present? ) else issue = orig_issue end journal = issue.init_journal(User.current, params[:notes]) issue.safe_attributes = attributes call_hook(:controller_issues_bulk_edit_before_save, { :params => params, :issue => issue }) if issue.save saved_issues << issue else unsaved_issues << orig_issue end end # ... render :action => 'bulk_edit' end end Reality