RE: [Rails] What does this represent : ENV["_"]

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

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

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. :wink:

Thanks a lot, dudes!

<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)