summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
Diffstat (limited to 'app/models')
-rw-r--r--app/models/gateway_parameter.rb8
-rw-r--r--app/models/gateway_setting.rb6
2 files changed, 11 insertions, 3 deletions
diff --git a/app/models/gateway_parameter.rb b/app/models/gateway_parameter.rb
index 1875863..3dd2a95 100644
--- a/app/models/gateway_parameter.rb
+++ b/app/models/gateway_parameter.rb
@@ -1,13 +1,17 @@
class GatewayParameter < ActiveRecord::Base
attr_accessible :gateway_id, :name, :value, :class_type, :description
- belongs_to :gateway
+ belongs_to :gateway, :touch => true
validates :name,
:presence => true,
- :uniqueness => true
+ :uniqueness => {:scope => :gateway_id}
validates :class_type,
:presence => true,
:inclusion => { :in => ['String', 'Integer', 'Boolean'] }
+
+ def to_s
+ name
+ end
end
diff --git a/app/models/gateway_setting.rb b/app/models/gateway_setting.rb
index bc676a4..078901f 100644
--- a/app/models/gateway_setting.rb
+++ b/app/models/gateway_setting.rb
@@ -5,9 +5,13 @@ class GatewaySetting < ActiveRecord::Base
validates :name,
:presence => true,
- :uniqueness => true
+ :uniqueness => {:scope => :gateway_id}
validates :class_type,
:presence => true,
:inclusion => { :in => ['String', 'Integer', 'Boolean'] }
+
+ def to_s
+ name
+ end
end