Best way to know the domain across all controllers?


#1

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


#2

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 M.


#3

Hi Tom,
Thank you for your reply.
I was interested in understanding the concept so your reply did help.

Thanks
Frank

Tom M. removed_email_address@domain.invalid wrote: Not worth it, if you ask
me.