aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
authorSteve Klabnik <steve@steveklabnik.com>2013-03-13 15:16:26 -0700
committerSteve Klabnik <steve@steveklabnik.com>2013-03-13 15:16:26 -0700
commit02caa0252736190dba41484f406c702e5069a0a6 (patch)
tree30dd094fe0cd838894fd2b765504dfa8e400e381 /actionpack/lib
parenta0920bc6ce0d02c4f6af8e81ff833fb7e4d0893b (diff)
parentf4d9f332c4b89f7f66637fa664005beb3bdbbb99 (diff)
downloadrails-02caa0252736190dba41484f406c702e5069a0a6.tar.gz
rails-02caa0252736190dba41484f406c702e5069a0a6.tar.bz2
rails-02caa0252736190dba41484f406c702e5069a0a6.zip
Merge pull request #9698 from garethrees/request_documentation
Add documentation to ActionDispatch::Request
Diffstat (limited to 'actionpack/lib')
-rw-r--r--actionpack/lib/action_dispatch/http/request.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/actionpack/lib/action_dispatch/http/request.rb b/actionpack/lib/action_dispatch/http/request.rb
index 7b04d6e851..e1b845d73a 100644
--- a/actionpack/lib/action_dispatch/http/request.rb
+++ b/actionpack/lib/action_dispatch/http/request.rb
@@ -156,14 +156,30 @@ module ActionDispatch
@original_fullpath ||= (env["ORIGINAL_FULLPATH"] || fullpath)
end
+ # Returns the +String+ full path including params of the last URL requested.
+ #
+ # app.get "/articles"
+ # app.response.fullpath # => "/articles"
+ #
+ # app.get "/articles?page=2"
+ # app.response.fullpath # => "/articles?page=2"
def fullpath
@fullpath ||= super
end
+ # Returns the original request URL as a +String+
+ #
+ # app.get "/articles?page=2"
+ # app.request.original_url
+ # # => "http://www.example.com/articles?page=2"
def original_url
base_url + original_fullpath
end
+ # The +String+ MIME type of the request
+ #
+ # app.get "/articles"
+ # # => "application/x-www-form-urlencoded"
def media_type
content_mime_type.to_s
end