From 2afb9b559c3b531b6078cac91ca3ff07a654b101 Mon Sep 17 00:00:00 2001 From: Eugene Korbut Date: Sun, 8 Feb 2009 04:38:30 +1000 Subject: [PATCH] prefenses page --- app/controllers/webmail_controller.rb | 4 +--- app/views/webmail/prefs.rhtml | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/app/controllers/webmail_controller.rb b/app/controllers/webmail_controller.rb index 22402db..cb6954b 100644 --- a/app/controllers/webmail_controller.rb +++ b/app/controllers/webmail_controller.rb @@ -194,9 +194,7 @@ class WebmailController < ApplicationController def prefs @customer = Customer.find(logged_customer) - if not(@mailpref = MailPref.find_by_customer(logged_customer)) - @mailpref = MailPref.create("customer_id"=>logged_customer) - end + @mailpref = MailPref.find_or_create_by_customer_id logged_customer if params['op'] == _('Save') if params['customer'] diff --git a/app/views/webmail/prefs.rhtml b/app/views/webmail/prefs.rhtml index 80a4a33..7f58a5a 100644 --- a/app/views/webmail/prefs.rhtml +++ b/app/views/webmail/prefs.rhtml @@ -11,7 +11,7 @@
-
+ <%= hidden_field "mailpref", "id" %> <%= hidden_field "mailpref", "customer_id" %>