where define the script_name?

module ActionController   module UrlFor     extend ActiveSupport::Concern

    include AbstractController::UrlFor I have read the rails source.In the actionpack/lib/action_controller/ metal/url_for.rb

    def url_options       @_url_options ||= super.reverse_merge(         :host => request.host,         :port => request.optional_port,         :protocol => request.protocol,         :_path_segments => request.symbolized_path_parameters       ).freeze

      if _routes.equal?(env["action_dispatch.routes"])         @_url_options.dup.tap do |options|           options[:script_name] = request.script_name.dup           options.freeze         end       else         @_url_options       end     end

  end end

I don't know where define the script_name.I execute the below command

apple@apple:~/rails$ grep --exclude-dir test -r script_name * actionpack/lib/action_controller/metal/url_for.rb: options[:script_name] = request.script_name.dup actionpack/lib/action_dispatch/routing/ route_set.rb: :trailing_slash, :anchor, :params, :only_path, :script_name] actionpack/lib/action_dispatch/routing/route_set.rb: script_name = options.delete(:script_name) actionpack/lib/action_dispatch/routing/route_set.rb: path = (script_name.blank? ? _generate_prefix(options) : script_name.chomp('/')).to_s railties/lib/rails/commands/plugin.rb: attr_reader :environment, :script_name railties/lib/rails/commands/plugin.rb: @script_name = File.basename($0) railties/lib/rails/commands/plugin.rb: o.separator " #{@script_name} plugin install http://example.com/my_svn_plugin\\n" railties/lib/rails/commands/plugin.rb: o.separator " #{@script_name} plugin install git://github.com/SomeGuy/my_awesome_plugin.git\n" railties/lib/rails/commands/plugin.rb: o.separator " #{@script_name} plugin install -x my_svn_plugin\n" railties/lib/rails/commands/plugin.rb: o.banner = "Usage: #{@base_command.script_name} install PLUGIN [PLUGIN [PLUGIN] ...]" railties/lib/rails/commands/plugin.rb: o.banner = "Usage: #{@base_command.script_name} remove name [name]..." railties/lib/rails/commands/plugin.rb: o.banner = "Usage: #{@base_command.script_name} info name [name]..." railties/lib/rails/commands/runner.rb: script_name = File.basename($0) apple@apple:~/rails$

what mean the script_name?where define the script_name?

It's part of the environment you get from rack / your web server (apache, nginx etc.). I'd check either the rack source or the documentation for your web server for its precise interpretation.

Fred

The script_name is assigned in journey-19defa6acfe8/lib/journe/ router.rb

      unless route.path.anchored           env['SCRIPT_NAME'] = script_name.to_s + match.to_s           env['PATH_INFO'] = match.post_match         end

Mongel has script_name but it isn't for my wanting.