Permalink
Browse files

Merge branch 'master' of github.com:lifo/docrails

Conflicts:
	actionpack/lib/action_view/helpers/asset_tag_helper.rb
  • Loading branch information...
2 parents 0be7fab + 7cd8884 commit 59b03d418ff59fe6bfba6a1b651ef0ac15a2738c @vijaydev vijaydev committed May 15, 2012
Showing with 161 additions and 341 deletions.
  1. +8 −6 actionpack/lib/action_controller/caching/pages.rb
  2. +0 −1 actionpack/lib/action_controller/metal/conditional_get.rb
  3. +0 −1 actionpack/lib/action_controller/metal/helpers.rb
  4. +0 −7 actionpack/lib/action_controller/metal/mime_responds.rb
  5. +0 −4 actionpack/lib/action_controller/metal/redirecting.rb
  6. +0 −1 actionpack/lib/action_controller/metal/renderers.rb
  7. +0 −2 actionpack/lib/action_controller/metal/request_forgery_protection.rb
  8. +0 −3 actionpack/lib/action_controller/metal/url_for.rb
  9. +3 −3 actionpack/lib/action_controller/record_identifier.rb
  10. +1 −6 actionpack/lib/action_controller/test_case.rb
  11. +0 −3 actionpack/lib/action_dispatch/http/filter_parameters.rb
  12. +1 −1 actionpack/lib/action_dispatch/middleware/flash.rb
  13. +1 −1 actionpack/lib/action_dispatch/middleware/session/cookie_store.rb
  14. +0 −11 actionpack/lib/action_dispatch/routing/mapper.rb
  15. +0 −2 actionpack/lib/action_dispatch/routing/url_for.rb
  16. +0 −6 actionpack/lib/action_dispatch/testing/assertions/dom.rb
  17. +0 −6 actionpack/lib/action_dispatch/testing/assertions/response.rb
  18. +0 −3 actionpack/lib/action_dispatch/testing/assertions/routing.rb
  19. +0 −6 actionpack/lib/action_dispatch/testing/assertions/selector.rb
  20. +0 −3 actionpack/lib/action_dispatch/testing/assertions/tag.rb
  21. +9 −16 actionpack/lib/action_view/helpers/asset_tag_helper.rb
  22. +0 −4 actionpack/lib/action_view/helpers/asset_tag_helpers/javascript_tag_helpers.rb
  23. +0 −3 actionpack/lib/action_view/helpers/asset_tag_helpers/stylesheet_tag_helpers.rb
  24. +0 −1 actionpack/lib/action_view/helpers/cache_helper.rb
  25. +0 −1 actionpack/lib/action_view/helpers/capture_helper.rb
  26. +0 −26 actionpack/lib/action_view/helpers/date_helper.rb
  27. +0 −3 actionpack/lib/action_view/helpers/debug_helper.rb
  28. +0 −5 actionpack/lib/action_view/helpers/form_helper.rb
  29. +0 −1 actionpack/lib/action_view/helpers/form_options_helper.rb
  30. +0 −3 actionpack/lib/action_view/helpers/sanitize_helper.rb
  31. +0 −2 actionpack/lib/action_view/helpers/tag_helper.rb
  32. +0 −11 actionpack/lib/action_view/helpers/text_helper.rb
  33. +1 −1 activemodel/lib/active_model/serialization.rb
  34. +8 −0 activerecord/lib/active_record/core.rb
  35. +0 −6 activesupport/lib/active_support/backtrace_cleaner.rb
  36. +0 −2 activesupport/lib/active_support/callbacks.rb
  37. +0 −2 activesupport/lib/active_support/core_ext/date/calculations.rb
  38. +0 −2 activesupport/lib/active_support/core_ext/date/conversions.rb
  39. +0 −2 activesupport/lib/active_support/core_ext/date_time/calculations.rb
  40. +0 −1 activesupport/lib/active_support/core_ext/date_time/conversions.rb
  41. +2 −2 activesupport/lib/active_support/core_ext/enumerable.rb
  42. +7 −2 activesupport/lib/active_support/core_ext/hash/deep_merge.rb
  43. +0 −2 activesupport/lib/active_support/core_ext/hash/diff.rb
  44. +9 −3 activesupport/lib/active_support/core_ext/hash/keys.rb
  45. +0 −2 activesupport/lib/active_support/core_ext/module/aliasing.rb
  46. +23 −1 activesupport/lib/active_support/core_ext/object/deep_dup.rb
  47. +2 −2 activesupport/lib/active_support/core_ext/object/try.rb
  48. +0 −2 activesupport/lib/active_support/core_ext/range/conversions.rb
  49. +1 −1 activesupport/lib/active_support/core_ext/string/inquiry.rb
  50. +0 −1 activesupport/lib/active_support/duration.rb
  51. +1 −8 activesupport/lib/active_support/inflector/inflections.rb
  52. +0 −13 activesupport/lib/active_support/inflector/methods.rb
  53. +0 −2 activesupport/lib/active_support/inflector/transliterate.rb
  54. +1 −2 activesupport/lib/active_support/multibyte.rb
  55. +0 −11 activesupport/lib/active_support/multibyte/chars.rb
  56. +0 −3 activesupport/lib/active_support/multibyte/unicode.rb
  57. +1 −1 activesupport/lib/active_support/tagged_logging.rb
  58. +0 −4 activesupport/lib/active_support/time_with_zone.rb
  59. +5 −5 activesupport/lib/active_support/values/time_zone.rb
  60. +0 −12 guides/source/active_support_core_extensions.textile
  61. +34 −1 guides/source/asset_pipeline.textile
  62. +1 −1 guides/source/configuring.textile
  63. +39 −28 guides/source/getting_started.textile
  64. +3 −3 guides/source/i18n.textile
  65. +0 −3 railties/lib/rails.rb
  66. +0 −5 railties/lib/rails/engine.rb
  67. +0 −4 railties/lib/rails/generators.rb
  68. +0 −42 railties/lib/rails/generators/actions.rb
  69. +0 −3 railties/lib/rails/generators/base.rb
  70. +0 −4 railties/lib/rails/generators/migration.rb
@@ -60,7 +60,8 @@ module Pages
end
module ClassMethods
- # Expires the page that was cached with the +path+ as a key. Example:
+ # Expires the page that was cached with the +path+ as a key.
+ #
# expire_page "/lists/show"
def expire_page(path)
return unless perform_caching
@@ -72,7 +73,8 @@ def expire_page(path)
end
end
- # Manually cache the +content+ in the key determined by +path+. Example:
+ # Manually cache the +content+ in the key determined by +path+.
+ #
# cache_page "I'm the cached content", "/lists/show"
def cache_page(content, path, extension = nil, gzip = Zlib::BEST_COMPRESSION)
return unless perform_caching
@@ -93,8 +95,6 @@ def cache_page(content, path, extension = nil, gzip = Zlib::BEST_COMPRESSION)
#
# You can also pass a :gzip option to override the class configuration one.
#
- # Usage:
- #
# # cache the index action
# caches_page :index
#
@@ -142,7 +142,8 @@ def instrument_page_cache(name, path)
end
end
- # Expires the page that was cached with the +options+ as a key. Example:
+ # Expires the page that was cached with the +options+ as a key.
+ #
# expire_page :controller => "lists", :action => "show"
def expire_page(options = {})
return unless self.class.perform_caching
@@ -161,7 +162,8 @@ def expire_page(options = {})
end
# Manually cache the +content+ in the key determined by +options+. If no content is provided, the contents of response.body is used.
- # If no options are provided, the url of the current request being handled is used. Example:
+ # If no options are provided, the url of the current request being handled is used.
+ #
# cache_page "I'm the cached content", :controller => "lists", :action => "show"
def cache_page(content = nil, options = nil, gzip = Zlib::BEST_COMPRESSION)
return unless self.class.perform_caching && caching_allowed?
@@ -108,7 +108,6 @@ def stale?(record_or_options, additional_options = {})
# Sets a HTTP 1.1 Cache-Control header. Defaults to issuing a <tt>private</tt> instruction, so that
# intermediate caches must not cache the response.
#
- # Examples:
# expires_in 20.minutes
# expires_in 3.hours, :public => true
# expires_in 3.hours, :public => true, :must_revalidate => true
@@ -16,7 +16,6 @@ module ActionController
# Additional helpers can be specified using the +helper+ class method in ActionController::Base or any
# controller which inherits from it.
#
- # ==== Examples
# The +to_s+ method from the \Time class can be wrapped in a helper method to display a custom message if
# a \Time object is blank:
#
@@ -16,8 +16,6 @@ module ClassMethods
# Defines mime types that are rendered by default when invoking
# <tt>respond_with</tt>.
#
- # Examples:
- #
# respond_to :html, :xml, :json
#
# Specifies that all actions in the controller respond to requests
@@ -185,7 +183,6 @@ def clear_respond_to
# end
#
# Be sure to check respond_with and respond_to documentation for more examples.
- #
def respond_to(*mimes, &block)
raise ArgumentError, "respond_to takes either types or a block, never both" if mimes.any? && block_given?
@@ -323,7 +320,6 @@ def respond_to(*mimes, &block)
# a successful html +post+ request.
# 2. <tt>:action</tt> - overwrites the default render action used after an
# unsuccessful html +post+ request.
- #
def respond_with(*resources, &block)
raise "In order to use respond_with, first you need to declare the formats your " <<
"controller responds to in the class level" if self.class.mimes_for_respond_to.empty?
@@ -339,7 +335,6 @@ def respond_with(*resources, &block)
# Collect mimes declared in the class method respond_to valid for the
# current action.
- #
def collect_mimes_from_class_level #:nodoc:
action = action_name.to_s
@@ -362,7 +357,6 @@ def collect_mimes_from_class_level #:nodoc:
#
# Sends :not_acceptable to the client and returns nil if no suitable format
# is available.
- #
def retrieve_collector_from_mimes(mimes=nil, &block) #:nodoc:
mimes ||= collect_mimes_from_class_level
collector = Collector.new(mimes)
@@ -401,7 +395,6 @@ def retrieve_collector_from_mimes(mimes=nil, &block) #:nodoc:
# A subsequent call to #negotiate_format(request) will enable the Collector
# to determine which specific mime-type it should respond with for the current
# request, with this response then being accessible by calling #response.
- #
class Collector
include AbstractController::Collector
attr_accessor :order, :format
@@ -24,7 +24,6 @@ module Redirecting
# * <tt>:back</tt> - Back to the page that issued the request. Useful for forms that are triggered from multiple places.
# Short-hand for <tt>redirect_to(request.env["HTTP_REFERER"])</tt>
#
- # Examples:
# redirect_to :action => "show", :id => 5
# redirect_to post
# redirect_to "http://www.rubyonrails.org"
@@ -35,7 +34,6 @@ module Redirecting
#
# The redirection happens as a "302 Moved" header unless otherwise specified.
#
- # Examples:
# redirect_to post_url(@post), :status => :found
# redirect_to :action=>'atom', :status => :moved_permanently
# redirect_to post_url(@post), :status => 301
@@ -51,14 +49,12 @@ module Redirecting
# around this you can return a <tt>303 See Other</tt> status code which will be
# followed using a GET request.
#
- # Examples:
# redirect_to posts_url, :status => :see_other
# redirect_to :action => 'index', :status => 303
#
# It is also possible to assign a flash message as part of the redirection. There are two special accessors for the commonly used flash names
# +alert+ and +notice+ as well as a general purpose +flash+ bucket.
#
- # Examples:
# redirect_to post_url(@post), :alert => "Watch it, mister!"
# redirect_to post_url(@post), :status=> :found, :notice => "Pay attention to the road"
# redirect_to post_url(@post), :status => 301, :flash => { :updated_post_id => @post.id }
@@ -49,7 +49,6 @@ def _handle_render_options(options)
# is the value paired with its key and the second is the remaining
# hash of options passed to +render+.
#
- # === Example
# Create a csv renderer:
#
# ActionController::Renderers.add :csv do |obj, options|
@@ -51,8 +51,6 @@ module RequestForgeryProtection
module ClassMethods
# Turn on request forgery protection. Bear in mind that only non-GET, HTML/JavaScript requests are checked.
#
- # Example:
- #
# class FooController < ApplicationController
# protect_from_forgery :except => :index
#
@@ -6,8 +6,6 @@ module ActionController
# url options like the +host+. In order to do so, this module requires the host class
# to implement +env+ and +request+, which need to be a Rack-compatible.
#
- # Example:
- #
# class RootUrl
# include ActionController::UrlFor
# include Rails.application.routes.url_helpers
@@ -19,7 +17,6 @@ module ActionController
# @url = root_path # named route from the application.
# end
# end
- #
module UrlFor
extend ActiveSupport::Concern
@@ -3,7 +3,7 @@
module ActionController
# The record identifier encapsulates a number of naming conventions for dealing with records, like Active Records or
# pretty much any other model type that has an id. These patterns are then used to try elevate the view actions to
- # a higher logical level. Example:
+ # a higher logical level.
#
# # routes
# resources :posts
@@ -30,7 +30,7 @@ module RecordIdentifier
JOIN = '_'.freeze
NEW = 'new'.freeze
- # The DOM class convention is to use the singular form of an object or class. Examples:
+ # The DOM class convention is to use the singular form of an object or class.
#
# dom_class(post) # => "post"
# dom_class(Person) # => "person"
@@ -45,7 +45,7 @@ def dom_class(record_or_class, prefix = nil)
end
# The DOM id convention is to use the singular form of an object or class with the id following an underscore.
- # If no id is found, prefix with "new_" instead. Examples:
+ # If no id is found, prefix with "new_" instead.
#
# dom_id(Post.find(45)) # => "post_45"
# dom_id(Post.new) # => "new_post"
@@ -56,8 +56,6 @@ def process(*args)
# Asserts that the request was rendered with the appropriate template file or partials.
#
- # ==== Examples
- #
# # assert that the "new" view template was rendered
# assert_template "new"
#
@@ -84,7 +82,6 @@ def process(*args)
#
# # assert that the "_customer" partial was rendered with a specific object
# assert_template :partial => '_customer', :locals => { :customer => @customer }
- #
def assert_template(options = {}, message = nil)
# Force body to be read in case the
# template is being streamed
@@ -350,7 +347,6 @@ def exists?
# == \Testing named routes
#
# If you're using named routes, they can be easily tested using the original named routes' methods straight in the test case.
- # Example:
#
# assert_redirected_to page_url(:title => 'foo')
class TestCase < ActiveSupport::TestCase
@@ -369,12 +365,11 @@ module Behavior
module ClassMethods
# Sets the controller class name. Useful if the name can't be inferred from test class.
- # Normalizes +controller_class+ before using. Examples:
+ # Normalizes +controller_class+ before using.
#
# tests WidgetController
# tests :widget
# tests 'widget'
- #
def tests(controller_class)
case controller_class
when String, Symbol
@@ -10,8 +10,6 @@ module Http
# value of the params hash and all subhashes is passed to it, the value
# or key can be replaced using String#replace or similar method.
#
- # Examples:
- #
# env["action_dispatch.parameter_filter"] = [:password]
# => replaces the value to all keys matching /password/i with "[FILTERED]"
#
@@ -22,7 +20,6 @@ module Http
# v.reverse! if k =~ /secret/i
# end
# => reverses the value to all keys matching /secret/i
- #
module FilterParameters
extend ActiveSupport::Concern
@@ -11,7 +11,7 @@ def flash
# The flash provides a way to pass temporary objects between actions. Anything you place in the flash will be exposed
# to the very next action and then cleared out. This is a great way of doing notices and alerts, such as a create
# action that sets <tt>flash[:notice] = "Post successfully created"</tt> before redirecting to a display action that can
- # then expose the flash to its template. Actually, that exposure is automatically done. Example:
+ # then expose the flash to its template. Actually, that exposure is automatically done.
#
# class PostsController < ActionController::Base
# def create
@@ -27,7 +27,7 @@ module Session
# CGI::Session instance as an argument. It's important that the secret
# is not vulnerable to a dictionary attack. Therefore, you should choose
# a secret consisting of random numbers and letters and more than 30
- # characters. Examples:
+ # characters.
#
# :secret => '449fe2e7daee471bffae2fd8dc02313d'
# :secret => Proc.new { User.current_user.secret_key }
@@ -495,8 +495,6 @@ module HttpHelpers
# Define a route that only recognizes HTTP GET.
# For supported arguments, see <tt>Base#match</tt>.
#
- # Example:
- #
# get 'bacon', :to => 'food#bacon'
def get(*args, &block)
map_method(:get, args, &block)
@@ -505,8 +503,6 @@ def get(*args, &block)
# Define a route that only recognizes HTTP POST.
# For supported arguments, see <tt>Base#match</tt>.
#
- # Example:
- #
# post 'bacon', :to => 'food#bacon'
def post(*args, &block)
map_method(:post, args, &block)
@@ -515,8 +511,6 @@ def post(*args, &block)
# Define a route that only recognizes HTTP PATCH.
# For supported arguments, see <tt>Base#match</tt>.
#
- # Example:
- #
# patch 'bacon', :to => 'food#bacon'
def patch(*args, &block)
map_method(:patch, args, &block)
@@ -525,8 +519,6 @@ def patch(*args, &block)
# Define a route that only recognizes HTTP PUT.
# For supported arguments, see <tt>Base#match</tt>.
#
- # Example:
- #
# put 'bacon', :to => 'food#bacon'
def put(*args, &block)
map_method(:put, args, &block)
@@ -535,8 +527,6 @@ def put(*args, &block)
# Define a route that only recognizes HTTP DELETE.
# For supported arguments, see <tt>Base#match</tt>.
#
- # Example:
- #
# delete 'broccoli', :to => 'food#broccoli'
def delete(*args, &block)
map_method(:delete, args, &block)
@@ -681,7 +671,6 @@ def scope(*args)
# Scopes routes to a specific controller
#
- # Example:
# controller "food" do
# match "bacon", :action => "bacon"
# end
@@ -132,8 +132,6 @@ def url_options
# Any other key (<tt>:controller</tt>, <tt>:action</tt>, etc.) given to
# +url_for+ is forwarded to the Routes module.
#
- # Examples:
- #
# url_for :controller => 'tasks', :action => 'testing', :host => 'somehost.org', :port => '8080'
# # => 'http://somehost.org:8080/tasks/testing'
# url_for :controller => 'tasks', :action => 'testing', :host => 'somehost.org', :anchor => 'ok', :only_path => true
@@ -5,11 +5,8 @@ module Assertions
module DomAssertions
# \Test two HTML strings for equivalency (e.g., identical up to reordering of attributes)
#
- # ==== Examples
- #
# # assert that the referenced method generates the appropriate HTML string
# assert_dom_equal '<a href="http://www.example.com">Apples</a>', link_to("Apples", "http://www.example.com")
- #
def assert_dom_equal(expected, actual, message = "")
expected_dom = HTML::Document.new(expected).root
actual_dom = HTML::Document.new(actual).root
@@ -18,11 +15,8 @@ def assert_dom_equal(expected, actual, message = "")
# The negated form of +assert_dom_equivalent+.
#
- # ==== Examples
- #
# # assert that the referenced method does not generate the specified HTML string
# assert_dom_not_equal '<a href="http://www.example.com">Apples</a>', link_to("Oranges", "http://www.example.com")
- #
def assert_dom_not_equal(expected, actual, message = "")
expected_dom = HTML::Document.new(expected).root
actual_dom = HTML::Document.new(actual).root
@@ -15,14 +15,11 @@ module ResponseAssertions
# or its symbolic equivalent <tt>assert_response(:not_implemented)</tt>.
# See Rack::Utils::SYMBOL_TO_STATUS_CODE for a full list.
#
- # ==== Examples
- #
# # assert that the response was a redirection
# assert_response :redirect
#
# # assert that the response code was status code 401 (unauthorized)
# assert_response 401
- #
def assert_response(type, message = nil)
message ||= "Expected response to be a <#{type}>, but was <#{@response.response_code}>"
@@ -42,8 +39,6 @@ def assert_response(type, message = nil)
# This match can be partial, such that <tt>assert_redirected_to(:controller => "weblog")</tt> will also
# match the redirection of <tt>redirect_to(:controller => "weblog", :action => "show")</tt> and so on.
#
- # ==== Examples
- #
# # assert that the redirection was to the "index" action on the WeblogController
# assert_redirected_to :controller => "weblog", :action => "index"
#
@@ -55,7 +50,6 @@ def assert_response(type, message = nil)
#
# # asserts that the redirection matches the regular expression
# assert_redirected_to %r(\Ahttp://example.org)
- #
def assert_redirected_to(options = {}, message=nil)
assert_response(:redirect, message)
return true if options === @response.location
Oops, something went wrong. Retry.

0 comments on commit 59b03d4

Please sign in to comment.