diff options
author | Stefan Wintermeyer <stefan.wintermeyer@amooma.de> | 2013-01-20 20:58:01 +0100 |
---|---|---|
committer | Stefan Wintermeyer <stefan.wintermeyer@amooma.de> | 2013-01-20 20:58:01 +0100 |
commit | 8ec95de06fcddf296d392ef6d04a46e68f2429ca (patch) | |
tree | 3479e67255b6612e1eca50245bb886680d305eb7 /app/controllers/tenants_controller.rb | |
parent | a2abe7dffb8fe31687910ca4be6dc0374a247d00 (diff) | |
parent | 4e67f8769a3a3199bfb5b363fe9baa231c329a2b (diff) |
Merge branch 'call_routes' into develop
Diffstat (limited to 'app/controllers/tenants_controller.rb')
-rw-r--r-- | app/controllers/tenants_controller.rb | 19 |
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 |