From: martyntaylor <[email protected]>
---
src/app/controllers/quota_controller.rb | 3 ++-
src/app/models/quota.rb | 13 +++++++++++--
2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/src/app/controllers/quota_controller.rb
b/src/app/controllers/quota_controller.rb
index 0cc1e2f..dc14d34 100644
--- a/src/app/controllers/quota_controller.rb
+++ b/src/app/controllers/quota_controller.rb
@@ -51,7 +51,8 @@ class QuotaController < ApplicationController
flash[:notice] = "Quota updated!"
redirect_to :action => 'show', :id => @parent, :parent_type =>
@parent_type
else
- render :action => :edit
+ flash[:notice] = "Could not update quota, please check you have entered
valid values"
+ redirect_to :action => :edit, :id => @parent, :parent_type =>
@parent_type
end
end
diff --git a/src/app/models/quota.rb b/src/app/models/quota.rb
index ad35076..83c20c4 100644
--- a/src/app/models/quota.rb
+++ b/src/app/models/quota.rb
@@ -25,8 +25,17 @@ class Quota < ActiveRecord::Base
has_one :cloud_account
has_one :user
- validates_numericality_of :maximum_total_instances,
:greater_than_or_equal_to => 0, :allow_nil => true
- validates_numericality_of :maximum_running_instances,
:greater_than_or_equal_to => 0, :allow_nil => true
+ validates_numericality_of :maximum_total_instances,
+ :greater_than_or_equal_to => 0,
+ :less_than_or_equal_to => 2147483647,
+ :integer_only => true,
+ :allow_nil => true
+
+ validates_numericality_of :maximum_running_instances,
+ :greater_than_or_equal_to => 0,
+ :less_than_or_equal_to => 2147483647,
+ :integer_only => true,
+ :allow_nil => true
QuotaResource = Struct.new(:name, :used, :max, :available, :unit)
--
1.7.2.3
_______________________________________________
deltacloud-devel mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/deltacloud-devel