From 55a0d5ce38f99226174f358279c02178eacd75d7 Mon Sep 17 00:00:00 2001 From: spag Date: Sun, 23 Dec 2012 16:04:05 +0100 Subject: login/logout methods --- app/controllers/phones_controller.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'app/controllers/phones_controller.rb') diff --git a/app/controllers/phones_controller.rb b/app/controllers/phones_controller.rb index d46bf86..0b765e8 100644 --- a/app/controllers/phones_controller.rb +++ b/app/controllers/phones_controller.rb @@ -14,7 +14,6 @@ class PhonesController < ApplicationController def new @phone = @phoneable.phones.build() - # Use the last phone.phone_model as the default. # @phone.phone_model_id = Phone.last.try(:phone_model).try(:id) @@ -22,6 +21,10 @@ class PhonesController < ApplicationController def create @phone = @phoneable.phones.build(params[:phone]) + if !@tenant + @tenant = @user.current_tenant + end + @phone.tenant = @tenant if @phone.save m = method( :"#{@phoneable.class.name.underscore}_phone_path" ) redirect_to m.( @phoneable, @phone ), :notice => t('phones.controller.successfuly_created') -- cgit v1.2.3