ruby - Change Rails 4 production.rb constants based on request.url -


please can point me in right direction i'm sure simple problem, causing me go round in circles.i have 3 domains

  1. .com
  2. .com.au
  3. .co.nz

    i'm trying keep single code base maintenance.

i've done manual localisation work to change titles, contact details etc based on url, using request.original_url , stripping out relevant parts , setting constants in application controller (site, email, telephone etc).

it works fine, except config.action_mailer.smtp_settings in production.rb.

these should change localised email account used (info@...com or .com.au etc)

i can't constants initialised before environment loaded. makes perfect sense why it's not working, have no idea how fix it.

i've tried putting in initializers, application.rb , setting in production.rb itself. if move code anywhere out of application controller no method error on request.original_url.

is there way of pulling out mailer settings can exposed variables? or production.rb loaded @ app start , after unaffected end user.

also, though language remaining same should @ i18n manipulating site these features? or not worth effort few variables want change.

thanks in advance.

you can change settings in runtime:

actionmailer::base.smtp_settings[:host] = 'yourhostfromrequest' 

Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -