Forum: Ruby on Rails To Use or not to use global variable

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
661ae6e97d0e16c2af2aaf7d197e8387?d=identicon&s=25 Sijo k g (sijo)
on 2008-11-05 11:39
Hi
   My application has facility that any user can create a ticket from
the intranet site.So upon creating a ticket he gives an email id .And I
have to send mail back to this mail id giving created ticket's
information..My application is running on differnt ports (say 3000 and
3001 or example) Both for two companies..So as part of ticket creation
email to be send to user@company1.com(if it created from company 1
intranet),  and similarly user2@company2.comif it created from company 2
intranet..here user1@company1.com and user2@ompany2.com are text boxes
eneterd by the user
     So where will I store the portion after @ (company1,company2) .Is
it inside a global variable by reading it from a yml file?This I am
doing to change code for second company..I think you understand the
problem

      And also one thing Suppose if I store it in a yml file can I call
this only once when I enter in to the controller ..As far I undestod
before_filer is called = no of times specified action is called

Thanks in advance
Sijo
2505b282d57c29be797dc35b245adb4c?d=identicon&s=25 Philip Hallstrom (Guest)
on 2008-11-05 17:43
(Received via mailing list)
On Nov 5, 2008, at 2:39 AM, Sijo Kg wrote:

> company 2
> intranet..here user1@company1.com and user2@ompany2.com are text boxes
> eneterd by the user
>     So where will I store the portion after @ (company1,company2) .Is
> it inside a global variable by reading it from a yml file?This I am
> doing to change code for second company..I think you understand the
> problem
>
>      And also one thing Suppose if I store it in a yml file can I call
> this only once when I enter in to the controller ..As far I undestod
> before_filer is called = no of times specified action is called

Start here.

http://agilewebdevelopment.com/plugins/application_config

‘application_config’ eases project configuring by introducing yaml
config file in RAILS_ROOT/config folder and provides handful methods
accessing config values based on current rails environment. So, you
can have separate sets of configuration properties for each rails
environment you use.
This topic is locked and can not be replied to.