Skip to content

Commit

Permalink
Move save! into top block so new service_template record is returned.
Browse files Browse the repository at this point in the history
Made copy methods private
  • Loading branch information
gmcculloug committed Jul 16, 2019
1 parent d84fc61 commit d898d53
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/models/service_template/copy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,14 @@ def template_copy(new_name = "Copy of " + name + Time.zone.now.to_s)

direct_custom_buttons.each { |custom_button| custom_button_copy(custom_button, template) }
custom_button_sets.each { |custom_button_set| custom_button_set_copy(custom_button_set, template) }
end.save!
template.save!
end
end
end
end

private

def resource_copy(service_resource, template)
resource = service_resource.resource.respond_to?(:service_template_resource_copy) ? service_resource.resource.service_template_resource_copy : service_resource.resource
template.add_resource(resource, service_resource)
Expand Down

0 comments on commit d898d53

Please sign in to comment.