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 def select_foodcoop
if Foodsoft.config[:multi_coop_install] if Foodsoft.config[:multi_coop_install]
if !params[:foodcoop].blank? if !params[:foodcoop].blank?
# Set Config begin
Foodsoft.env = params[:foodcoop] # Set Config
# Set database-connection Foodsoft.env = params[:foodcoop]
ActiveRecord::Base.establish_connection(Foodsoft.database) # Set database-connection
ActiveRecord::Base.establish_connection(Foodsoft.database)
rescue => error
flash[:error] = error.to_s
redirect_to root_path
end
else else
redirect_to root_path redirect_to root_path
end end

View file

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

View file

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

View file

@ -18,11 +18,12 @@ end
Foodsoft.env = RAILS_ENV Foodsoft.env = RAILS_ENV
# Set action mailer default host for url generating # Set action mailer default host for url generating
ActionMailer::Base.default_url_options = { url_options = {
:host => Foodsoft.config[:host], :host => Foodsoft.config[:host],
:port => Foodsoft.config[:port], :protocol => Foodsoft.config[:protocol]
: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 # Configuration of the exception_notification plugin
# Mailadresses are set in config/foodsoft.yaml # Mailadresses are set in config/foodsoft.yaml