Hi, Does somebody know to what the following exactly refers to? ENV["_"] I have read about ''ENV["RAILS_ENV"]'' but don''t understand the above mentioned. -> Is this something defined by Rails itself or is it some custom variable? -> In my case, a plugin doesn''t work because ENV["_"] is ''nil''. Do you have an idea why? Or how could I circumvent that problem to make the plugin work anyway? Thank you in advance for any hint! Tom -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Forgot to add: this variable occurs in the following line: require File.join(File.dirname(ENV["_"]), ''../config/environment.rb'') -> What does that try to do exactly? What file exactly does it try to ''require''? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
ENV is a hash-like something or other provided by ruby to give access to environment variables. That looks like a strange name for an environment variable--not sure what your plugin is going for there... -----Original Message----- From: rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org [mailto:rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org] On Behalf Of Tom Ha Sent: Tuesday, May 20, 2008 11:49 AM To: rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Subject: [Rails] What does this represent : ENV["_"] Hi, Does somebody know to what the following exactly refers to? ENV["_"] I have read about ''ENV["RAILS_ENV"]'' but don''t understand the above mentioned. -> Is this something defined by Rails itself or is it some custom variable? -> In my case, a plugin doesn''t work because ENV["_"] is ''nil''. Do you have an idea why? Or how could I circumvent that problem to make the plugin work anyway? Thank you in advance for any hint! Tom -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I believe ENV["_"] is the built in rails constant that points to the environment.rb file location require File.join(File.dirname(ENV["_"]), ''../config/environment.rb'') is a "require" statement for the environment.rb file File.join is concatinating the "dirname" part or the environment file location Windows example (C:rails_projects/myproject) with ../config/environment.rb'' to get: require C:rails_projects/myproject/config/environment.rb --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ah, a bit more info--the underbar environment variable looks to be a unix thing. Or at least--on my windows box, I get nil back from ruby if I do a one-line "puts(ENV[''_''])" via a DOS box, but doing the same via a cygwin bash prompt I get back the path to the ruby executable (/usr/bin/ruby). Soooo--I''m guessing the original poster is running on windows, and his plugin author was on something unixy. But definitely the plugin is looking to include the environment.rb file for the currently running rails app. Not totally sure how to make that cross-platform friendly... I suppose you could hard-code it if you can deal with that dirty feeling that won''t wash off. ;-) -----Original Message----- From: rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org [mailto:rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org] On Behalf Of Ruby Freak Sent: Tuesday, May 20, 2008 12:35 PM To: Ruby on Rails: Talk Subject: [Rails] Re: What does this represent : ENV["_"] I believe ENV["_"] is the built in rails constant that points to the environment.rb file location require File.join(File.dirname(ENV["_"]), ''../config/environment.rb'') is a "require" statement for the environment.rb file File.join is concatinating the "dirname" part or the environment file location Windows example (C:rails_projects/myproject) with ../config/environment.rb'' to get: require C:rails_projects/myproject/config/environment.rb --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thanks a lot, dudes! -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
<Ah, a bit more info--the underbar environment variable looks to be a <unix thing That''s good to know as I cross-dress between ubuntu and XP Play with puts ENV or p ENV (which should print the entire hash) etc to see what you get and maybe just replace ''ENV["_"]'' with ''ENV["RAILS_ENV"]'' or what ever seems to be the enviroment path in ENV (You probably already did that) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---