softwareengineer 99
2006-Feb-08 16:23 UTC
[Rails] Best way to know the domain across all controllers?
Hello, I would like to use something like domain=request.domain and be able to access the domain variable across all my controllers. What is the best way to do so? In which file can I put the above variable declaration and still be able to access it application wide? I guess I am asking on assistance for using global variables in rails. Can anyone please guide me to a source or help me figure this out. Thanks Frank --------------------------------- Relax. Yahoo! Mail virus scanning helps detect nasty viruses! -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060208/3dee8cdf/attachment.html
Tom Mornini
2006-Feb-08 16:37 UTC
[Rails] Best way to know the domain across all controllers?
application.rb def set_domain @domain=request.domain end In your controllers... before_filter :set_domain All that gets you, though, is the ability to replace: request.domain with @domain Not worth it, if you ask me. -- -- Tom Mornini On Feb 8, 2006, at 8:23 AM, softwareengineer 99 wrote:> Hello, > I would like to use something like > domain=request.domain > and be able to access the domain variable across all my controllers. > > What is the best way to do so? In which file can I put the above > variable declaration and still be able to access it application wide? > > I guess I am asking on assistance for using global variables in rails. > > Can anyone please guide me to a source or help me figure this out. > > Thanks > Frank > > Relax. Yahoo! Mail virus scanning helps detect nasty viruses! > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060208/9560b51a/attachment.html
softwareengineer 99
2006-Feb-08 19:34 UTC
[Rails] Best way to know the domain across all controllers?
Hi Tom, Thank you for your reply. I was interested in understanding the concept so your reply did help. Thanks Frank Tom Mornini <tmornini@infomania.com> wrote: Not worth it, if you ask me. --------------------------------- Yahoo! Mail - Helps protect you from nasty viruses. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060208/f86f7765/attachment.html