Get current url

Hi friends,

i need current url in rails environment file.

i can get current url in conroller by the below command.

request.env[‘HTTP_HOST’]

and now i want get current url in environment.rb file or intializer folder files

Regards,

Daya.

Hi friends,

i need current url in rails environment file.

i can get current url in conroller by the below command.

request.env['HTTP_HOST']

and now i want get current url in environment.rb file or intializer folder
files

environment.rb and initialisers are run when the server is started,
there is no current url at that time as the first request may not have
been made yet.

Colin

There is no "current url" at initialization time. What are you trying to do?

hi friends

first thanks for your immediate reply.

i am using omnicontacts for import friends concepts. so i created google api key that redirect uri is

http://example.com/contacts/gmail/callback

if i enter http://example.com that time i got correct reply

if i enter http://www.example.com that time i got redirect uri is miss match(google error)

so i create two api keys one for http://example.com another one for http://www.example.com.

if i get current url in omnicontacts.rb i will give a correct rediect path using in conditional statment.