Permalink
Browse files

Merge branch 'master' of git://github.com/rails/rails

  • Loading branch information...
2 parents 6d772c0 + e746c40 commit 47b8415bef7edb25bb750685d6f9331f044bbd80 @fxn fxn committed Aug 31, 2011
Showing with 2,490 additions and 1,815 deletions.
  1. +1 −0 .gitignore
  2. +3 −1 .travis.yml
  3. +7 −2 Gemfile
  4. +6 −6 README.rdoc
  5. +14 −7 RELEASING_RAILS.rdoc
  6. +8 −2 Rakefile
  7. +4 −0 actionpack/CHANGELOG
  8. +4 −4 actionpack/actionpack.gemspec
  9. +5 −4 actionpack/lib/abstract_controller/view_paths.rb
  10. +1 −1 actionpack/lib/action_controller/base.rb
  11. +1 −1 actionpack/lib/action_controller/metal/data_streaming.rb
  12. +3 −3 actionpack/lib/action_controller/metal/instrumentation.rb
  13. +10 −11 actionpack/lib/action_controller/metal/params_wrapper.rb
  14. +1 −1 actionpack/lib/action_controller/metal/redirecting.rb
  15. +1 −1 actionpack/lib/action_controller/metal/url_for.rb
  16. +4 −6 actionpack/lib/action_controller/test_case.rb
  17. +1 −1 actionpack/lib/action_controller/vendor/html-scanner/html/node.rb
  18. +3 −14 actionpack/lib/action_dispatch/http/upload.rb
  19. +1 −2 actionpack/lib/action_dispatch/railtie.rb
  20. +9 −5 actionpack/lib/action_dispatch/routing/url_for.rb
  21. +2 −0 actionpack/lib/action_view/base.rb
  22. +10 −7 actionpack/lib/action_view/helpers/form_tag_helper.rb
  23. +12 −3 actionpack/lib/action_view/helpers/javascript_helper.rb
  24. +1 −1 actionpack/lib/action_view/helpers/url_helper.rb
  25. +1 −1 actionpack/lib/action_view/lookup_context.rb
  26. +60 −13 actionpack/lib/action_view/path_set.rb
  27. +30 −33 actionpack/lib/action_view/template/resolver.rb
  28. +46 −15 actionpack/lib/sprockets/assets.rake
  29. +23 −7 actionpack/lib/sprockets/compressors.rb
  30. +31 −25 actionpack/lib/sprockets/helpers/rails_helper.rb
  31. +2 −2 actionpack/lib/sprockets/railtie.rb
  32. +5 −0 actionpack/test/controller/redirect_test.rb
  33. +14 −0 actionpack/test/controller/render_test.rb
  34. +0 −108 actionpack/test/controller/routing_test.rb
  35. +23 −0 actionpack/test/controller/test_test.rb
  36. +183 −0 actionpack/test/controller/url_for_integration_test.rb
  37. +12 −0 actionpack/test/dispatch/routing_test.rb
  38. +1 −0 actionpack/test/fixtures/test/hello_w*rld.erb
  39. +1 −1 actionpack/test/template/compiled_templates_test.rb
  40. +10 −4 actionpack/test/template/form_tag_helper_test.rb
  41. +7 −0 actionpack/test/template/html-scanner/sanitizer_test.rb
  42. +6 −0 actionpack/test/template/javascript_helper_test.rb
  43. +1 −1 actionpack/test/template/render_test.rb
  44. +30 −4 actionpack/test/template/sprockets_helper_test.rb
  45. +2 −0 activemodel/CHANGELOG
  46. +1 −1 activemodel/activemodel.gemspec
  47. +7 −1 activemodel/lib/active_model/errors.rb
  48. +2 −2 activemodel/lib/active_model/observing.rb
  49. +2 −0 activemodel/lib/active_model/serialization.rb
  50. +2 −0 activemodel/lib/active_model/validations/acceptance.rb
  51. +2 −0 activemodel/lib/active_model/validations/confirmation.rb
  52. +2 −0 activemodel/lib/active_model/validations/exclusion.rb
  53. +2 −0 activemodel/lib/active_model/validations/format.rb
  54. +2 −0 activemodel/lib/active_model/validations/inclusion.rb
  55. +2 −0 activemodel/lib/active_model/validations/length.rb
  56. +2 −0 activemodel/lib/active_model/validations/numericality.rb
  57. +2 −0 activemodel/lib/active_model/validations/presence.rb
  58. +15 −3 activemodel/lib/active_model/validations/validates.rb
  59. +4 −2 activemodel/lib/active_model/validations/with.rb
  60. +12 −0 activemodel/test/cases/observing_test.rb
  61. +14 −1 activemodel/test/cases/serialization_test.rb
  62. +33 −0 activemodel/test/cases/validations_test.rb
  63. +2 −0 activerecord/CHANGELOG
  64. +1 −1 activerecord/activerecord.gemspec
  65. +2 −8 activerecord/lib/active_record.rb
  66. +10 −6 activerecord/lib/active_record/associations.rb
  67. +12 −6 activerecord/lib/active_record/associations/alias_tracker.rb
  68. +8 −8 activerecord/lib/active_record/associations/association.rb
  69. +5 −5 activerecord/lib/active_record/associations/belongs_to_polymorphic_association.rb
  70. +2 −2 activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb
  71. +2 −3 activerecord/lib/active_record/associations/join_dependency.rb
  72. +1 −1 activerecord/lib/active_record/associations/preloader/has_and_belongs_to_many.rb
  73. +2 −3 activerecord/lib/active_record/attribute_methods/primary_key.rb
  74. +37 −48 activerecord/lib/active_record/base.rb
  75. +15 −4 activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb
  76. +33 −14 activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb
  77. +3 −2 activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb
  78. +45 −12 activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
  79. +611 −0 activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb
  80. +54 −513 activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb
  81. +83 −580 activerecord/lib/active_record/connection_adapters/mysql_adapter.rb
  82. +7 −1 activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
  83. +2 −0 activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb
  84. +26 −7 activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb
  85. +1 −1 activerecord/lib/active_record/counter_cache.rb
  86. +2 −2 activerecord/lib/active_record/locking/optimistic.rb
  87. +3 −3 activerecord/lib/active_record/migration.rb
  88. +1 −1 activerecord/lib/active_record/observer.rb
  89. +1 −1 activerecord/lib/active_record/persistence.rb
  90. +6 −0 activerecord/lib/active_record/query_cache.rb
  91. +1 −1 activerecord/lib/active_record/railties/databases.rake
  92. +17 −12 activerecord/lib/active_record/relation.rb
  93. +2 −2 activerecord/lib/active_record/relation/calculations.rb
  94. +3 −3 activerecord/lib/active_record/relation/finder_methods.rb
  95. +1 −1 activerecord/lib/active_record/relation/predicate_builder.rb
  96. +2 −7 activerecord/lib/active_record/relation/query_methods.rb
  97. +12 −1 activerecord/lib/active_record/timestamp.rb
  98. +13 −0 activerecord/test/cases/adapter_test.rb
  99. +4 −4 activerecord/test/cases/adapters/mysql/active_schema_test.rb
  100. +0 −15 activerecord/test/cases/adapters/postgresql/schema_test.rb
  101. +18 −0 activerecord/test/cases/adapters/postgresql/utils_test.rb
  102. +16 −0 activerecord/test/cases/adapters/sqlite3/sqlite3_adapter_test.rb
  103. +6 −2 activerecord/test/cases/associations/extension_test.rb
  104. +12 −0 activerecord/test/cases/associations/has_many_through_associations_test.rb
  105. +1 −1 activerecord/test/cases/associations/nested_through_associations_test.rb
  106. +46 −20 activerecord/test/cases/base_test.rb
  107. +1 −1 activerecord/test/cases/calculations_test.rb
  108. +16 −16 activerecord/test/cases/column_definition_test.rb
  109. +4 −0 activerecord/test/cases/connection_pool_test.rb
  110. +12 −0 activerecord/test/cases/lifecycle_test.rb
  111. +4 −4 activerecord/test/cases/method_scoping_test.rb
  112. +1 −1 activerecord/test/cases/primary_keys_test.rb
  113. +27 −1 activerecord/test/cases/query_cache_test.rb
  114. +19 −1 activerecord/test/cases/relation_scoping_test.rb
  115. +61 −0 activerecord/test/cases/relations_test.rb
  116. +9 −0 activerecord/test/models/developer.rb
  117. +2 −0 activerecord/test/models/toy.rb
  118. +15 −1 activesupport/CHANGELOG
  119. +1 −0 activesupport/lib/active_support/core_ext/array.rb
  120. +7 −0 activesupport/lib/active_support/core_ext/array/prepend_and_append.rb
  121. +5 −2 activesupport/lib/active_support/core_ext/big_decimal/conversions.rb
  122. +15 −0 activesupport/lib/active_support/core_ext/io.rb
  123. +32 −19 activesupport/lib/active_support/core_ext/module/delegation.rb
  124. +1 −1 activesupport/lib/active_support/core_ext/string/output_safety.rb
  125. +1 −0 activesupport/lib/active_support/core_ext/time/calculations.rb
  126. +8 −3 activesupport/lib/active_support/dependencies.rb
  127. +1 −0 activesupport/lib/active_support/gzip.rb
  128. +2 −1 activesupport/lib/active_support/i18n_railtie.rb
  129. +1 −0 activesupport/lib/active_support/inflections.rb
  130. +0 −2 activesupport/lib/active_support/notifications.rb
  131. +0 −1 activesupport/lib/active_support/railtie.rb
  132. +26 −8 activesupport/lib/active_support/values/time_zone.rb
  133. +10 −0 activesupport/test/core_ext/array_ext_test.rb
  134. +23 −0 activesupport/test/core_ext/io_test.rb
  135. +34 −2 activesupport/test/core_ext/module_test.rb
  136. +7 −0 activesupport/test/core_ext/string_ext_test.rb
  137. +18 −0 activesupport/test/dependencies_test.rb
  138. +1 −0 activesupport/test/notifications_test.rb
  139. +17 −0 railties/CHANGELOG
  140. +4 −4 railties/README.rdoc
  141. +4 −44 railties/guides/rails_guides/generator.rb
  142. +22 −3 railties/guides/rails_guides/textile_extensions.rb
  143. +4 −2 railties/guides/source/3_1_release_notes.textile
  144. +26 −31 railties/guides/source/action_mailer_basics.textile
  145. +6 −2 railties/guides/source/active_model_basics.textile
  146. +2 −2 railties/guides/source/active_record_querying.textile
  147. +3 −1 railties/guides/source/active_support_core_extensions.textile
  148. +34 −9 railties/guides/source/asset_pipeline.textile
  149. +2 −0 railties/guides/source/command_line.textile
  150. +1 −1 railties/guides/source/getting_started.textile
  151. +9 −1 railties/guides/source/index.html.erb
  152. +1 −1 railties/guides/source/initialization.textile
  153. +3 −1 railties/guides/source/layout.html.erb
  154. +4 −2 railties/lib/rails.rb
  155. +5 −0 railties/lib/rails/application.rb
  156. +1 −1 railties/lib/rails/application/bootstrap.rb
  157. +14 −7 railties/lib/rails/application/configuration.rb
  158. +2 −1 railties/lib/rails/commands.rb
  159. +1 −0 railties/lib/rails/engine.rb
  160. +3 −2 railties/lib/rails/engine/commands.rb
  161. +2 −2 railties/lib/rails/generators.rb
  162. +3 −3 railties/lib/rails/generators/rails/app/templates/app/assets/stylesheets/application.css
  163. +1 −1 railties/lib/rails/generators/rails/app/templates/config/application.rb
  164. +6 −0 railties/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt
  165. +2 −2 railties/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt
  166. +3 −0 railties/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt
  167. +7 −3 railties/lib/rails/generators/rails/app/templates/config/initializers/wrap_parameters.rb.tt
  168. +0 −2 railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb
  169. 0 ...rails/generators/rails/plugin_new/templates/app/views/layouts/{ → %name%}/application.html.erb.tt
  170. +2 −1 railties/lib/rails/plugin.rb
  171. +1 −0 railties/lib/rails/railtie.rb
  172. +2 −0 railties/lib/rails/tasks/documentation.rake
  173. +56 −0 railties/test/application/asset_debugging_test.rb
  174. +17 −5 railties/test/application/assets_test.rb
  175. +2 −1 railties/test/application/middleware/sendfile_test.rb
  176. +10 −1 railties/test/generators/app_generator_test.rb
  177. +7 −7 tasks/release.rb
View
@@ -21,4 +21,5 @@ railties/doc
railties/guides/output
railties/tmp
.rvmrc
+.rbenv-version
RDOC_MAIN.rdoc
View
@@ -2,6 +2,7 @@ script: 'ci/travis.rb'
rvm:
- 1.8.7
- 1.9.2
+ - 1.9.3
env:
- "GEM=railties"
- "GEM=ap,am,amo,ares,as"
@@ -11,4 +12,5 @@ env:
notifications:
email: false
irc:
- - "irc.freenode.org#rails-contrib"
+ - "irc.freenode.org#rails-contrib"
+bundler_args: --path vendor/bundle
View
@@ -11,12 +11,17 @@ gem "jquery-rails"
# it being automatically loaded by sprockets
gem "uglifier", ">= 1.0.0", :require => false
-gem "rake", ">= 0.8.7"
+# Temp fix until rake 0.9.3 is out
+if RUBY_VERSION >= "1.9.3"
+ gem "rake", "0.9.3.beta.1"
+else
+ gem "rake", ">= 0.8.7"
+end
gem "mocha", ">= 0.9.8"
group :doc do
gem "rdoc", "~> 3.4"
- gem "horo", "= 1.0.3"
+ gem "sdoc", "~> 0.3"
gem "RedCloth", "~> 4.2" if RUBY_VERSION < "1.9.3"
gem "w3c_validators"
end
View
@@ -8,28 +8,28 @@ into three layers, each with a specific responsibility.
The View layer is composed of "templates" that are responsible for providing
appropriate representations of your application's resources. Templates
-can come in a variety of formats, but most view templates are HTML with embedded Ruby
+can come in a variety of formats, but most view templates are \HTML with embedded Ruby
code (.erb files).
The Model layer represents your domain model (such as Account, Product, Person, Post)
and encapsulates the business logic that is specific to your application. In Rails,
-database-backed model classes are derived from ActiveRecord::Base. ActiveRecord allows
+database-backed model classes are derived from ActiveRecord::Base. Active Record allows
you to present the data from database rows as objects and embellish these data objects
with business logic methods. Although most Rails models are backed by a database, models
can also be ordinary Ruby classes, or Ruby classes that implement a set of interfaces as
provided by the ActiveModel module. You can read more about Active Record in its
-{README}[link:blob/master/activerecord/README.rdoc].
+{README}[link:/rails/rails/blob/master/activerecord/README.rdoc].
The Controller layer is responsible for handling incoming HTTP requests and providing a
-suitable response. Usually this means returning HTML, but Rails controllers can also
+suitable response. Usually this means returning \HTML, but Rails controllers can also
generate XML, JSON, PDFs, mobile-specific views, and more. Controllers manipulate models
and render view templates in order to generate the appropriate HTTP response.
In Rails, the Controller and View layers are handled together by Action Pack.
These two layers are bundled in a single package due to their heavy interdependence.
This is unlike the relationship between Active Record and Action Pack which are
independent. Each of these packages can be used independently outside of Rails. You
-can read more about Action Pack in its {README}[link:blob/master/actionpack/README.rdoc].
+can read more about Action Pack in its {README}[link:/rails/rails/blob/master/actionpack/README.rdoc].
== Getting Started
@@ -62,7 +62,7 @@ can read more about Action Pack in its {README}[link:blob/master/actionpack/READ
* The {API Documentation}[http://api.rubyonrails.org].
-== Contributing
+== Contributing http://travis-ci.org/rails/rails.png
We encourage you to contribute to Ruby on Rails! Please check out the {Contributing to Rails
guide}[http://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html] for guidelines about how
View
@@ -145,18 +145,25 @@ commits should be added to the release branch besides regression fixing commits.
Many of these steps are the same as for the release candidate, so if you need
more explanation on a particular step, so the RC steps.
-=== Email the rails security announce list, once for each vulnerability fixed.
-
-You can do this, or ask the security team to do it.
-
-FIXME: I can't remember the email addresses, but we should list them here.
-FIXME: Possibly we should do this the day of the RC?
+Today, do this stuff in this order:
* Apply security patches to the release branch
* Update CHANGELOG with security fixes.
* Update RAILS_VERSION to remove the rc
* Release the gems
-* Email announcement
+* Email security lists
+* Email general announcement lists
+
+=== Emailing the rails security announce list
+
+Email the security announce list once for each vulnerability fixed.
+
+You can do this, or ask the security team to do it.
+
+Email the security reports to:
+
+* rubyonrails-security@googlegroups.com
+* linux-distros@vs.openwall.org
Be sure to note the security fixes in your announcement along with CVE numbers
and links to each patch. Some people may not be able to upgrade right away,
View
@@ -1,6 +1,7 @@
#!/usr/bin/env rake
require 'rdoc/task'
+require 'sdoc'
require 'net/http'
$:.unshift File.expand_path('..', __FILE__)
@@ -74,7 +75,10 @@ RDoc::Task.new do |rdoc|
# since no autolinking happens there and RDoc displays the backslash
# otherwise.
rdoc_main.gsub!(/^(?=\S).*?\b(?=Rails)\b/) { "#$&\\" }
- rdoc_main.gsub!(%r{link:blob/master/(\w+)/README\.rdoc}, "link:files/\\1/README_rdoc.html")
+ rdoc_main.gsub!(%r{link:/rails/rails/blob/master/(\w+)/README\.rdoc}, "link:files/\\1/README_rdoc.html")
+
+ # Remove Travis build status image from API pages. Only GitHub README page gets this image
+ rdoc_main.gsub!("http://travis-ci.org/rails/rails.png", "")
File.open(RDOC_MAIN, 'w') do |f|
f.write(rdoc_main)
@@ -86,8 +90,10 @@ RDoc::Task.new do |rdoc|
rdoc.rdoc_dir = 'doc/rdoc'
rdoc.title = "Ruby on Rails Documentation"
- rdoc.options << '-f' << 'horo'
+ rdoc.options << '-f' << 'sdoc'
+ rdoc.options << '-T' << 'rails'
rdoc.options << '-c' << 'utf-8'
+ rdoc.options << '-g' # SDoc flag, link methods to GitHub
rdoc.options << '-m' << RDOC_MAIN
rdoc.rdoc_files.include('railties/CHANGELOG')
View
@@ -30,6 +30,10 @@
*Rails 3.1.0 (unreleased)*
+* Param values are `paramified` in controller tests. [David Chelimsky]
+
+* x_sendfile_header now defaults to nil and config/environments/production.rb doesn't set a particular value for it. This allows servers to set it through X-Sendfile-Type. [Santiago Pastorino]
+
* The submit form helper does not generate an id "object_name_id" anymore. [fbrusatti]
* Make sure respond_with with :js tries to render a template in all cases [José Valim]
@@ -18,13 +18,13 @@ Gem::Specification.new do |s|
s.add_dependency('activesupport', version)
s.add_dependency('activemodel', version)
- s.add_dependency('rack-cache', '~> 1.0.2')
+ s.add_dependency('rack-cache', '~> 1.0.3')
s.add_dependency('builder', '~> 3.0.0')
s.add_dependency('i18n', '~> 0.6')
s.add_dependency('rack', '~> 1.3.2')
- s.add_dependency('rack-test', '~> 0.6.0')
- s.add_dependency('rack-mount', '~> 0.8.1')
- s.add_dependency('sprockets', '~> 2.0.0.beta.12')
+ s.add_dependency('rack-test', '~> 0.6.1')
+ s.add_dependency('rack-mount', '~> 0.8.2')
+ s.add_dependency('sprockets', '~> 2.0.0')
s.add_dependency('erubis', '~> 2.7.0')
s.add_development_dependency('tzinfo', '~> 0.3.29')
@@ -1,3 +1,5 @@
+require 'action_view/base'
+
module AbstractController
module ViewPaths
extend ActiveSupport::Concern
@@ -63,7 +65,7 @@ module ClassMethods
# the default view path. You may also provide a custom view path
# (see ActionView::PathSet for more information)
def append_view_path(path)
- self.view_paths = view_paths.dup + Array(path)
+ self._view_paths = view_paths + Array(path)
end
# Prepend a path to the list of view paths for this controller.
@@ -73,7 +75,7 @@ def append_view_path(path)
# the default view path. You may also provide a custom view path
# (see ActionView::PathSet for more information)
def prepend_view_path(path)
- self.view_paths = Array(path) + view_paths.dup
+ self._view_paths = ActionView::PathSet.new(Array(path) + view_paths)
end
# A list of all of the default view paths for this controller.
@@ -87,8 +89,7 @@ def view_paths
# * <tt>paths</tt> - If a PathSet is provided, use that;
# otherwise, process the parameter into a PathSet.
def view_paths=(paths)
- self._view_paths = ActionView::Base.process_view_paths(paths)
- self._view_paths.freeze
+ self._view_paths = ActionView::PathSet.new(Array.wrap(paths))
end
end
end
@@ -63,7 +63,7 @@ module ActionController
#
# == Sessions
#
- # Sessions allows you to store objects in between requests. This is useful for objects that are not yet ready to be persisted,
+ # Sessions allow you to store objects in between requests. This is useful for objects that are not yet ready to be persisted,
# such as a Signup object constructed in a multi-paged process, or objects that don't change much and are needed all the time, such
# as a User object for a system that requires login. The session should not be used, however, as a cache for objects where it's likely
# they could be changed unknowingly. It's usually too much work to keep it all synchronized -- something databases already excel at.
@@ -17,7 +17,7 @@ module DataStreaming
protected
# Sends the file. This uses a server-appropriate method (such as X-Sendfile)
# via the Rack::Sendfile middleware. The header to use is set via
- # config.action_dispatch.x_sendfile_header, and defaults to "X-Sendfile".
+ # config.action_dispatch.x_sendfile_header.
# Your server can also configure this for you by setting the X-Sendfile-Type header.
#
# Be careful to sanitize the path parameter if it is coming from a web
@@ -58,8 +58,8 @@ def send_data(data, options = {})
def redirect_to(*args)
ActiveSupport::Notifications.instrument("redirect_to.action_controller") do |payload|
result = super
- payload[:status] = self.status
- payload[:location] = self.location
+ payload[:status] = response.status
+ payload[:location] = response.location
result
end
end
@@ -97,4 +97,4 @@ def log_process_action(payload) #:nodoc:
end
end
end
-end
+end
@@ -6,31 +6,30 @@
require 'action_dispatch/http/mime_types'
module ActionController
- # Wraps parameters hash into nested hash. This will allow client to submit
- # POST request without having to specify a root element in it.
+ # Wraps the parameters hash into a nested hash. This will allow clients to submit
+ # POST requests without having to specify any root elements.
#
- # By default this functionality won't be enabled. You can enable
- # it globally by setting +ActionController::Base.wrap_parameters+:
- #
- # ActionController::Base.wrap_parameters = [:json]
+ # This functionality is enabled in +config/initializers/wrap_parameters.rb+
+ # and can be customized. If you are upgrading to \Rails 3.1, this file will
+ # need to be created for the functionality to be enabled.
#
# You could also turn it on per controller by setting the format array to
- # non-empty array:
+ # a non-empty array:
#
# class UsersController < ApplicationController
# wrap_parameters :format => [:json, :xml]
# end
#
- # If you enable +ParamsWrapper+ for +:json+ format. Instead of having to
+ # If you enable +ParamsWrapper+ for +:json+ format, instead of having to
# send JSON parameters like this:
#
# {"user": {"name": "Konata"}}
#
- # You can now just send a parameters like this:
+ # You can send parameters like this:
#
# {"name": "Konata"}
#
- # And it will be wrapped into a nested hash with the key name matching
+ # And it will be wrapped into a nested hash with the key name matching the
# controller's name. For example, if you're posting to +UsersController+,
# your new +params+ hash will look like this:
#
@@ -82,7 +81,7 @@ module ClassMethods
#
# ==== Examples
# wrap_parameters :format => :xml
- # # enables the parmeter wrapper for XML format
+ # # enables the parameter wrapper for XML format
#
# wrap_parameters :person
# # wraps parameters into +params[:person]+ hash
@@ -45,7 +45,7 @@ module Redirecting
# integer, or a symbol representing the downcased, underscored and symbolized description.
# Note that the status code must be a 3xx HTTP code, or redirection will not occur.
#
- # It is also possible to assign a flash message as part of the redirection. There are two special accessors for commonly used the flash names
+ # 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:
@@ -18,7 +18,7 @@
# @url = root_path # named route from the application.
# end
# end
-# =>
+#
module ActionController
module UrlFor
extend ActiveSupport::Concern
@@ -180,7 +180,7 @@ def recycle!
@env.delete_if { |k, v| k =~ /^action_dispatch\.rescue/ }
@symbolized_path_params = nil
@method = @request_method = nil
- @fullpath = @ip = @remote_ip = nil
+ @fullpath = @ip = @remote_ip = @protocol = nil
@env['action_dispatch.request.query_parameters'] = {}
@set_cookies ||= {}
@set_cookies.update(Hash[cookie_jar.instance_variable_get("@set_cookies").map{ |k,o| [k,o[:value]] }])
@@ -401,9 +401,7 @@ def xml_http_request(request_method, action, parameters = nil, session = nil, fl
def paramify_values(hash_or_array_or_value)
case hash_or_array_or_value
when Hash
- hash_or_array_or_value.each do |key, value|
- hash_or_array_or_value[key] = paramify_values(value)
- end
+ Hash[hash_or_array_or_value.map{|key, value| [key, paramify_values(value)] }]
when Array
hash_or_array_or_value.map {|i| paramify_values(i)}
when Rack::Test::UploadedFile
@@ -416,7 +414,7 @@ def paramify_values(hash_or_array_or_value)
def process(action, parameters = nil, session = nil, flash = nil, http_method = 'GET')
# Ensure that numbers and symbols passed as params are converted to
# proper params, as is the case when engaging rack.
- paramify_values(parameters)
+ parameters = paramify_values(parameters)
# Sanity check for required instance variables so we can give an
# understandable error message.
@@ -450,7 +448,7 @@ def process(action, parameters = nil, session = nil, flash = nil, http_method =
@controller.params.merge!(parameters)
build_request_uri(action, parameters)
@controller.class.class_eval { include Testing }
- @controller.recycle!
+ @controller.recycle!
@controller.process_with_new_base_test(@request, @response)
@assigns = @controller.respond_to?(:view_assigns) ? @controller.view_assigns : {}
@request.session.delete('flash') if @request.session['flash'].blank?
@@ -156,7 +156,7 @@ def parse(parent, line, pos, content, strict=true)
end
closing = ( scanner.scan(/\//) ? :close : nil )
- return Text.new(parent, line, pos, content) unless name = scanner.scan(/[\w:-]+/)
+ return Text.new(parent, line, pos, content) unless name = scanner.scan(/[^\s!>\/]+/)
name.downcase!
unless closing
@@ -11,24 +11,13 @@ def initialize(hash)
raise(ArgumentError, ':tempfile is required') unless @tempfile
end
- def open
- @tempfile.open
- end
-
- def path
- @tempfile.path
- end
-
def read(*args)
@tempfile.read(*args)
end
- def rewind
- @tempfile.rewind
- end
-
- def size
- @tempfile.size
+ # Delegate these methods to the tempfile.
+ [:open, :path, :rewind, :size].each do |method|
+ class_eval "def #{method}; @tempfile.#{method}; end"
end
private
Oops, something went wrong.

0 comments on commit 47b8415

Please sign in to comment.