summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorPeter Kozak <spag@golwen.net>2013-06-12 14:22:20 +0200
committerPeter Kozak <spag@golwen.net>2013-06-12 14:22:20 +0200
commita14b1df01fa143c172857fb67c9bed3ac4262116 (patch)
treea2733643c631aea4a7ba949621a156e553473713 /app/models
parentd8dce422831675d0aca7b9a640b20bb5a5e947ab (diff)
create default settings
Diffstat (limited to 'app/models')
-rw-r--r--app/models/gateway.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/app/models/gateway.rb b/app/models/gateway.rb
index bf391fb..01b29b2 100644
--- a/app/models/gateway.rb
+++ b/app/models/gateway.rb
@@ -19,6 +19,8 @@ class Gateway < ActiveRecord::Base
after_initialize :set_defaults
before_validation :downcase_technology
+ after_create :create_default_settings
+
def to_s
name
end
@@ -65,4 +67,12 @@ class Gateway < ActiveRecord::Base
end
end
+ def create_default_settings
+ if self.technology == 'sip' then
+ GsParameter.where(:entity => 'sip_gateways', :section => 'settings').each do |default_setting|
+ self.gateway_settings.create(:name => default_setting.name, :value => default_setting.value, :class_type => default_setting.class_type, :description => default_setting.description)
+ end
+ end
+ end
+
end