Removed unnecessary config params. Improved error handling.

This commit is contained in:
Benjamin Meichsner 2010-03-22 01:25:24 +01:00
parent 61a87dacb6
commit 18e8a11b7d
4 changed files with 17 additions and 14 deletions

View file

@ -140,10 +140,15 @@ class ApplicationController < ActionController::Base
def select_foodcoop
if Foodsoft.config[:multi_coop_install]
if !params[:foodcoop].blank?
# Set Config
Foodsoft.env = params[:foodcoop]
# Set database-connection
ActiveRecord::Base.establish_connection(Foodsoft.database)
begin
# Set Config
Foodsoft.env = params[:foodcoop]
# Set database-connection
ActiveRecord::Base.establish_connection(Foodsoft.database)
rescue => error
flash[:error] = error.to_s
redirect_to root_path
end
else
redirect_to root_path
end

View file

@ -1,6 +1,6 @@
<%= yield %>
--
FoodSoft: <%= @foodsoftUrl %>
Foodcoop-Homepage: <%= Foodsoft.config[:base_url] %>
FoodSoft: <%= url_for(:controller => "home", :action => "index", :only_path => false) %>
Foodcoop-Homepage: <%= Foodsoft.config[:homepage] %>
Hilfe/Help: <%= Foodsoft.config[:help_url] %>

View file

@ -22,9 +22,6 @@ development: &defaults
email: foodsoft@myfoodcoop.org
phone: "030 323 23249"
# base URL for this installation
base_url: http://foodsoft.fctest.de
# Homepage
homepage: http://www.fctest.de

View file

@ -18,11 +18,12 @@ end
Foodsoft.env = RAILS_ENV
# Set action mailer default host for url generating
ActionMailer::Base.default_url_options = {
:host => Foodsoft.config[:host],
:port => Foodsoft.config[:port],
:protocol => Foodsoft.config[:protocol]
url_options = {
:host => Foodsoft.config[:host],
:protocol => Foodsoft.config[:protocol]
}
url_options.merge!({:port => Foodsoft.config[:port]}) if Foodsoft.config[:port]
ActionMailer::Base.default_url_options = url_options
# Configuration of the exception_notification plugin
# Mailadresses are set in config/foodsoft.yaml