app/controllers/itsf/backend/resource/base_controller.rb in itsf_backend-4.0.0 vs app/controllers/itsf/backend/resource/base_controller.rb in itsf_backend-4.0.1
- old
+ new
@@ -43,17 +43,17 @@
end
private
def after_create_location
- return edit_resource_path(@resource) if params.has_key?(:commit_and_continue_with_edit)
- return new_resource_path if params.has_key?(:commit_and_continue_with_new)
+ return edit_resource_path(@resource) if params.has_key?(:commit_and_continue_with_edit) && @resource.persisted?
+ return new_resource_path if params.has_key?(:commit_and_continue_with_new) && @resource.persisted?
@resource
end
def after_update_location
- return edit_resource_path(@resource) if params.has_key?(:commit_and_continue_with_edit)
- return new_resource_path if params.has_key?(:commit_and_continue_with_new)
+ return edit_resource_path(@resource) if params.has_key?(:commit_and_continue_with_edit) && !@resource.changed?
+ return new_resource_path if params.has_key?(:commit_and_continue_with_new) && !@resource.changed?
@resource
end
end
end