aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib')
-rw-r--r--actionpack/lib/action_controller/metal.rb27
-rw-r--r--actionpack/lib/action_dispatch/http/url.rb7
-rw-r--r--actionpack/lib/action_dispatch/routing/mapper.rb2
-rw-r--r--actionpack/lib/action_view/helpers/form_helper.rb2
4 files changed, 20 insertions, 18 deletions
diff --git a/actionpack/lib/action_controller/metal.rb b/actionpack/lib/action_controller/metal.rb
index 032769a5c6..b2c8053584 100644
--- a/actionpack/lib/action_controller/metal.rb
+++ b/actionpack/lib/action_controller/metal.rb
@@ -43,11 +43,11 @@ module ActionController
end
end
- # ActionController::Metal is the simplest possible controller, providing a
+ # <tt>ActionController::Metal</tt> is the simplest possible controller, providing a
# valid Rack interface without the additional niceties provided by
- # ActionController::Base.
+ # <tt>ActionController::Base</tt>.
#
- # A sample Metal controller might look like this:
+ # A sample metal controller might look like this:
#
# class HelloController < ActionController::Metal
# def index
@@ -55,26 +55,25 @@ module ActionController
# end
# end
#
- # And then to route requests to your Metal controller, you would add
+ # And then to route requests to your metal controller, you would add
# something like this to <tt>config/routes.rb</tt>:
#
- # match '/hello', :to => HelloController.action(:index),
- # :as => 'hello'
+ # match 'hello', :to => HelloController.action(:index)
#
- # The action method returns a valid Rack application for the \Rails
+ # The +action+ method returns a valid Rack application for the \Rails
# router to dispatch to.
#
# == Rendering Helpers
#
- # ActionController::Metal by default provides no utilities for rendering
+ # <tt>ActionController::Metal</tt> by default provides no utilities for rendering
# views, partials, or other responses aside from explicitly calling of
- # response_body=, content_type=, and status=. To
+ # <tt>response_body=</tt>, <tt>content_type=</tt>, and <tt>status=</tt>. To
# add the render helpers you're used to having in a normal controller, you
# can do the following:
#
# class HelloController < ActionController::Metal
# include ActionController::Rendering
- # append_view_path Rails.root + "app/views"
+ # append_view_path "#{Rails.root}/app/views"
#
# def index
# render "hello/index"
@@ -83,10 +82,11 @@ module ActionController
#
# == Redirection Helpers
#
- # To add redirection helpers to your Metal controller, do the following:
+ # To add redirection helpers to your metal controller, do the following:
#
# class HelloController < ActionController::Metal
# include ActionController::Redirecting
+ # include Rails.application.routes.url_helpers
#
# def index
# redirect_to root_url
@@ -95,9 +95,8 @@ module ActionController
#
# == Other Helpers
#
- # You can refer to the modules defined in ActionController to see
- # the other features in ActionController::Base that you can bring
- # into your Metal controller.
+ # You can refer to the modules included in <tt>ActionController::Base</tt> to see
+ # other features you can bring into your metal controller.
#
class Metal < AbstractController::Base
abstract!
diff --git a/actionpack/lib/action_dispatch/http/url.rb b/actionpack/lib/action_dispatch/http/url.rb
index 796cd8c09b..535ff42b90 100644
--- a/actionpack/lib/action_dispatch/http/url.rb
+++ b/actionpack/lib/action_dispatch/http/url.rb
@@ -28,8 +28,11 @@ module ActionDispatch
rewritten_url = ""
unless options[:only_path]
- rewritten_url << (options[:protocol] || "http")
- rewritten_url << "://" unless rewritten_url.match("://")
+ unless options[:protocol] == false
+ rewritten_url << (options[:protocol] || "http")
+ rewritten_url << ":" unless rewritten_url.match(%r{:|//})
+ end
+ rewritten_url << "//" unless rewritten_url.match("//")
rewritten_url << rewrite_authentication(options)
rewritten_url << host_or_subdomain_and_domain(options)
rewritten_url << ":#{options.delete(:port)}" if options[:port]
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb
index a91b2e88fb..f3f7cb6507 100644
--- a/actionpack/lib/action_dispatch/routing/mapper.rb
+++ b/actionpack/lib/action_dispatch/routing/mapper.rb
@@ -1221,7 +1221,7 @@ module ActionDispatch
end
def shallow
- scope(:shallow => true) do
+ scope(:shallow => true, :shallow_path => @scope[:path]) do
yield
end
end
diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb
index d7b9e0b4f4..d6edef0d34 100644
--- a/actionpack/lib/action_view/helpers/form_helper.rb
+++ b/actionpack/lib/action_view/helpers/form_helper.rb
@@ -1243,7 +1243,7 @@ module ActionView
def submit(value=nil, options={})
value, options = nil, value if value.is_a?(Hash)
value ||= submit_default_value
- @template.submit_tag(value, options.reverse_merge(:id => "#{object_name}_submit"))
+ @template.submit_tag(value, options)
end
def emitted_hidden_id?