The start-up script for rails has the following code:
version = ">= 0"
str = ARGV.first
str = str.dup.force_encoding("BINARY") if str.respond_to? :force_encoding
if str =~ /\A_(.*)_\z/ and Gem::Version.correct?($1) then
version = $1
gem 'railties', version
load Gem.bin_path('railties', 'rails', version)
Most likely this is because Rails uses
ARGV to read its own command line arguments. If the start-up script failed to remove its argument (the first one) from
ARGV before starting Rails, Rails would complain about an unexpected first argument, and probably abort.