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?

--
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@googlegroups.com.
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.

Search Discussions

  • Frederick Cheung at Dec 13, 2011 at 5:18 pm

    On Dec 13, 2:28 pm, blackspace wrote:
    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

    --
    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@googlegroups.com.
    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.
  • Blackspace at Dec 14, 2011 at 6:55 pm

    On 12月14日, 上午1时18分, Frederick Cheung wrote:
    On Dec 13, 2:28 pm, blackspace wrote:


    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.

    --
    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@googlegroups.com.
    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.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedDec 13, '11 at 5:01p
activeDec 14, '11 at 6:55p
posts3
users2
websiterubyonrails.org
irc#RubyOnRails

2 users in discussion

Blackspace: 2 posts Frederick Cheung: 1 post

People

Translate

site design / logo © 2022 Grokbase