summaryrefslogtreecommitdiff
path: root/app/controllers/tenants_controller.rb
diff options
context:
space:
mode:
authorStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-01-22 15:33:06 +0100
committerStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-01-22 15:33:06 +0100
commit39aa7132ceed3d4beab3a9b828e571bbfc67c07e (patch)
tree6c88289c9f99be0af8635636fcdf64102090e5ec /app/controllers/tenants_controller.rb
parent5ad8203ce4f1bfea997960d0b52c626dea24b944 (diff)
parent6f69c1a85055ec7c2515719d79d2a7a4e60cec50 (diff)
Merge branch 'develop'5.1-beta1
Diffstat (limited to 'app/controllers/tenants_controller.rb')
-rw-r--r--app/controllers/tenants_controller.rb19
1 files changed, 17 insertions, 2 deletions
diff --git a/app/controllers/tenants_controller.rb b/app/controllers/tenants_controller.rb
index 7bb8ecd..cb67e5f 100644
--- a/app/controllers/tenants_controller.rb
+++ b/app/controllers/tenants_controller.rb
@@ -1,13 +1,17 @@
class TenantsController < ApplicationController
- load_and_authorize_resource :tenant
+ authorize_resource :tenant
def index
+ @tenants = Tenant.scoped
end
def show
+ @tenant = Tenant.find(params[:id])
+ @gateways = Gateway.order(:updated_at)
end
def new
+ @tenant = Tenant.new
@tenant.name = generate_a_new_name(@tenant)
@tenant.sip_domain = SipDomain.last
@tenant.country = GemeinschaftSetup.first.country
@@ -18,6 +22,8 @@ class TenantsController < ApplicationController
end
def create
+ @tenant = Tenant.new(tenant_params)
+
if @tenant.save
# Become a member of this tenant.
#
@@ -86,10 +92,12 @@ class TenantsController < ApplicationController
end
def edit
+ @tenant = Tenant.find(params[:id])
end
def update
- if @tenant.update_attributes(params[:tenant])
+ @tenant = Tenant.find(params[:id])
+ if @tenant.update_attributes(tenant_params)
redirect_to @tenant, :notice => t('tenants.controller.successfuly_updated')
else
render :edit
@@ -97,8 +105,15 @@ class TenantsController < ApplicationController
end
def destroy
+ @tenant = Tenant.find(params[:id])
@tenant.destroy
redirect_to tenants_url, :notice => t('tenants.controller.successfuly_destroyed')
end
+
+ private
+ def tenant_params
+ params.require(:tenant).permit(:name, :description, :sip_domain_id, :country_id, :language_id, :from_field_pin_change_email, :from_field_voicemail_email
+)
+ end
end