Permalink
Browse files

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

  • Loading branch information...
2 parents 493cf44 + 6d05c79 commit e2e2d6298ebd9c67d0dc14c1e3481a59a4edf5d2 @HeeL HeeL committed Nov 28, 2011
Showing with 2,855 additions and 1,812 deletions.
  1. +1 −0 .gitignore
  2. +2 −5 Gemfile
  3. +52 −0 RELEASING_RAILS.rdoc
  4. +38 −0 actionpack/CHANGELOG.md
  5. +1 −1 actionpack/actionpack.gemspec
  6. +2 −2 actionpack/lib/abstract_controller/railties/routes_helpers.rb
  7. +9 −11 actionpack/lib/action_controller/metal/renderers.rb
  8. +10 −0 actionpack/lib/action_controller/metal/rescue.rb
  9. +2 −0 actionpack/lib/action_controller/railtie.rb
  10. +4 −3 actionpack/lib/action_controller/railties/paths.rb
  11. +4 −1 actionpack/lib/action_dispatch/middleware/cookies.rb
  12. +4 −9 actionpack/lib/action_dispatch/middleware/params_parser.rb
  13. +24 −13 actionpack/lib/action_dispatch/middleware/remote_ip.rb
  14. +19 −15 actionpack/lib/action_dispatch/middleware/show_exceptions.rb
  15. +1 −0 actionpack/lib/action_dispatch/middleware/templates/rescues/layout.erb
  16. +3 −1 actionpack/lib/action_dispatch/railtie.rb
  17. +53 −56 actionpack/lib/action_dispatch/routing/mapper.rb
  18. +63 −59 actionpack/lib/action_dispatch/routing/redirection.rb
  19. +2 −2 actionpack/lib/action_dispatch/routing/url_for.rb
  20. BIN actionpack/lib/action_view/data/encoding_conversions.dump
  21. +88 −0 actionpack/lib/action_view/data/encoding_conversions.txt
  22. +3 −0 actionpack/lib/action_view/helpers/asset_tag_helpers/stylesheet_tag_helpers.rb
  23. +1 −1 actionpack/lib/action_view/helpers/atom_feed_helper.rb
  24. +9 −1 actionpack/lib/action_view/helpers/form_helper.rb
  25. +2 −1 actionpack/lib/action_view/helpers/number_helper.rb
  26. +11 −4 actionpack/lib/action_view/helpers/translation_helper.rb
  27. +7 −2 actionpack/lib/action_view/renderer/partial_renderer.rb
  28. +7 −6 actionpack/lib/action_view/template.rb
  29. +1 −1 actionpack/lib/sprockets/helpers/rails_helper.rb
  30. +2 −2 actionpack/test/abstract_unit.rb
  31. +2 −4 actionpack/test/activerecord/polymorphic_routes_test.rb
  32. +59 −0 actionpack/test/controller/show_exceptions_test.rb
  33. +2 −2 actionpack/test/dispatch/cookies_test.rb
  34. +13 −5 actionpack/test/dispatch/request/json_params_parsing_test.rb
  35. +14 −6 actionpack/test/dispatch/request/xml_params_parsing_test.rb
  36. +7 −2 actionpack/test/dispatch/request_test.rb
  37. +6 −34 actionpack/test/dispatch/routing_test.rb
  38. +49 −58 actionpack/test/dispatch/show_exceptions_test.rb
  39. +2 −2 actionpack/test/lib/controller/fake_models.rb
  40. +47 −1 actionpack/test/template/form_helper_test.rb
  41. +7 −0 actionpack/test/template/render_test.rb
  42. +3 −0 actionpack/test/template/sprockets_helper_test.rb
  43. +17 −1 actionpack/test/template/translation_helper_test.rb
  44. +11 −1 activemodel/CHANGELOG.md
  45. +1 −0 activemodel/lib/active_model.rb
  46. +32 −27 activemodel/lib/active_model/attribute_methods.rb
  47. +1 −1 activemodel/lib/active_model/callbacks.rb
  48. +1 −1 activemodel/lib/active_model/dirty.rb
  49. +16 −11 activemodel/lib/active_model/naming.rb
  50. +144 −0 activemodel/lib/active_model/serializable.rb
  51. +108 −0 activemodel/lib/active_model/serializable/json.rb
  52. +195 −0 activemodel/lib/active_model/serializable/xml.rb
  53. +5 −134 activemodel/lib/active_model/serialization.rb
  54. +253 −0 activemodel/lib/active_model/serializer.rb
  55. +3 −99 activemodel/lib/active_model/serializers/json.rb
  56. +5 −186 activemodel/lib/active_model/serializers/xml.rb
  57. +3 −3 activemodel/lib/active_model/validations/presence.rb
  58. +1 −1 activemodel/lib/active_model/validations/with.rb
  59. +47 −4 activemodel/test/cases/naming_test.rb
  60. +1 −1 activemodel/test/cases/{serializers/json_serialization_test.rb → serializable/json_test.rb}
  61. +2 −2 activemodel/test/cases/{serializers/xml_serialization_test.rb → serializable/xml_test.rb}
  62. +2 −2 activemodel/test/cases/{serialization_test.rb → serializable_test.rb}
  63. +6 −6 activemodel/test/cases/validations/exclusion_validation_test.rb
  64. +12 −12 activemodel/test/cases/validations/format_validation_test.rb
  65. +6 −6 activemodel/test/cases/validations/inclusion_validation_test.rb
  66. +2 −6 activemodel/test/models/blog_post.rb
  67. +34 −0 activerecord/CHANGELOG.md
  68. +1 −1 activerecord/activerecord.gemspec
  69. +6 −2 activerecord/lib/active_record/associations/has_many_association.rb
  70. +1 −1 activerecord/lib/active_record/attribute_methods/read.rb
  71. +1 −1 activerecord/lib/active_record/attribute_methods/write.rb
  72. +9 −9 activerecord/lib/active_record/base.rb
  73. +30 −77 activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb
  74. +11 −20 activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
  75. +3 −18 activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
  76. +5 −17 activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb
  77. +1 −4 activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
  78. +72 −0 activerecord/lib/active_record/connection_adapters/schema_cache.rb
  79. +9 −14 activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb
  80. +1 −0 activerecord/lib/active_record/persistence.rb
  81. +93 −58 activerecord/lib/active_record/railties/databases.rake
  82. +3 −2 activerecord/lib/active_record/relation.rb
  83. +8 −6 activerecord/lib/active_record/relation/predicate_builder.rb
  84. +1 −1 activerecord/lib/active_record/serialization.rb
  85. +3 −3 activerecord/lib/active_record/serializers/xml_serializer.rb
  86. +5 −6 activerecord/lib/active_record/session_store.rb
  87. +6 −1 activerecord/test/active_record/connection_adapters/fake_adapter.rb
  88. +0 −10 activerecord/test/cases/adapter_test.rb
  89. +5 −1 activerecord/test/cases/adapters/mysql/schema_test.rb
  90. +3 −0 activerecord/test/cases/adapters/mysql2/explain_test.rb
  91. +5 −1 activerecord/test/cases/adapters/mysql2/schema_test.rb
  92. +3 −0 activerecord/test/cases/adapters/postgresql/explain_test.rb
  93. +1 −1 activerecord/test/cases/adapters/postgresql/schema_test.rb
  94. +3 −0 activerecord/test/cases/adapters/sqlite3/explain_test.rb
  95. +4 −1 activerecord/test/cases/adapters/sqlite3/sqlite3_adapter_test.rb
  96. +8 −0 activerecord/test/cases/base_test.rb
  97. +55 −0 activerecord/test/cases/connection_adapters/schema_cache_test.rb
  98. +0 −37 activerecord/test/cases/connection_pool_test.rb
  99. +4 −0 activerecord/test/cases/finder_test.rb
  100. +1 −175 activerecord/test/cases/migration_test.rb
  101. +0 −72 activerecord/test/cases/pooled_connections_test.rb
  102. +1 −1 activeresource/lib/active_resource/custom_methods.rb
  103. +3 −0 activesupport/CHANGELOG.md
  104. +69 −66 activesupport/lib/active_support/cache.rb
  105. +5 −10 activesupport/lib/active_support/concern.rb
  106. +24 −11 activesupport/lib/active_support/core_ext/date/calculations.rb
  107. +2 −2 activesupport/lib/active_support/core_ext/object/to_json.rb
  108. +28 −10 activesupport/lib/active_support/core_ext/time/calculations.rb
  109. +22 −14 activesupport/lib/active_support/dependencies.rb
  110. +4 −4 activesupport/lib/active_support/json/encoding.rb
  111. +1 −1 activesupport/lib/active_support/ordered_hash.rb
  112. +5 −2 activesupport/lib/active_support/time_with_zone.rb
  113. +73 −54 activesupport/test/caching_test.rb
  114. +28 −15 activesupport/test/class_cache_test.rb
  115. +2 −5 activesupport/test/concern_test.rb
  116. +18 −0 activesupport/test/core_ext/date_time_ext_test.rb
  117. +3 −4 activesupport/test/core_ext/integer_ext_test.rb
  118. +26 −0 activesupport/test/core_ext/time_ext_test.rb
  119. +9 −2 activesupport/test/core_ext/time_with_zone_test.rb
  120. +22 −5 railties/CHANGELOG.md
  121. +1 −1 railties/guides/code/getting_started/app/views/layouts/application.html.erb
  122. +5 −0 railties/guides/code/getting_started/config/application.rb
  123. +0 −5 railties/guides/code/getting_started/config/environments/test.rb
  124. +4 −11 railties/guides/source/action_mailer_basics.textile
  125. +16 −0 railties/guides/source/active_record_querying.textile
  126. +12 −6 railties/guides/source/active_support_core_extensions.textile
  127. +1 −1 railties/guides/source/asset_pipeline.textile
  128. +5 −0 railties/guides/source/configuring.textile
  129. +1 −1 railties/guides/source/contributing_to_ruby_on_rails.textile
  130. +3 −1 railties/guides/source/getting_started.textile
  131. +1 −1 railties/guides/source/i18n.textile
  132. +11 −11 railties/guides/source/initialization.textile
  133. +2 −2 railties/guides/source/migrations.textile
  134. +1 −1 railties/guides/source/testing.textile
  135. +29 −2 railties/lib/rails/application.rb
  136. +3 −2 railties/lib/rails/application/configuration.rb
  137. +34 −3 railties/lib/rails/application/route_inspector.rb
  138. +14 −3 railties/lib/rails/code_statistics.rb
  139. +1 −1 railties/lib/rails/commands/dbconsole.rb
  140. +161 −159 railties/lib/rails/commands/plugin.rb
  141. +48 −19 railties/lib/rails/engine.rb
  142. +4 −3 railties/lib/rails/generators/actions.rb
  143. +1 −0 railties/lib/rails/generators/app_base.rb
  144. +1 −1 railties/lib/rails/generators/rails/app/templates/app/views/layouts/application.html.erb.tt
  145. +5 −0 railties/lib/rails/generators/rails/app/templates/config/application.rb
  146. +0 −5 railties/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt
  147. +16 −4 railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb
  148. +1 −1 .../lib/rails/generators/rails/plugin_new/templates/app/views/layouts/%name%/application.html.erb.tt
  149. +1 −1 railties/lib/rails/railtie.rb
  150. +1 −0 railties/test/application/configuration_test.rb
  151. +0 −1 railties/test/application/console_test.rb
  152. +47 −0 railties/test/application/middleware/cookies_test.rb
  153. +1 −1 railties/test/application/rackup_test.rb
  154. +26 −0 railties/test/application/route_inspect_test.rb
  155. +5 −3 railties/test/generators/actions_test.rb
  156. +7 −0 railties/test/generators/app_generator_test.rb
  157. +6 −0 railties/test/generators/plugin_new_generator_test.rb
  158. +129 −3 railties/test/railties/engine_test.rb
  159. +1 −0 tasks/release.rb
View
@@ -2,6 +2,7 @@
# Check out http://help.github.com/ignore-files/ for how to set that up.
debug.log
+.Gemfile
/.bundle
/.rbenv-version
/.rvmrc
View
@@ -36,13 +36,11 @@ gem "memcache-client", ">= 1.8.5"
platforms :mri_18 do
gem "system_timer"
- gem "ruby-debug", ">= 0.10.3" unless ENV['TRAVIS']
gem "json"
end
-platforms :mri_19 do
- gem "ruby-debug19", :require => "ruby-debug" unless ENV['TRAVIS']
-end
+# Add your own local bundler stuff
+instance_eval File.read ".Gemfile" if File.exists? ".Gemfile"
platforms :mri do
group :test do
@@ -69,7 +67,6 @@ platforms :ruby do
end
platforms :jruby do
- gem "ruby-debug", ">= 0.10.3"
gem "json"
gem "activerecord-jdbcsqlite3-adapter", ">= 1.2.0"
View
@@ -25,6 +25,12 @@ for Rails. You can check the status of his tests here:
Do not release with Red AWDwR tests.
+=== Are the postgres tests green? If not, make them green
+
+Currently Travis CI doesn't run the Active Record postgres tests. They are
+working to resolve this, but in the mean time, it is crucial to ensure that
+the tests are still green before release.
+
=== Do we have any git dependencies? If so, contact those authors.
Having git dependencies indicates that we depend on unreleased code.
@@ -60,6 +66,8 @@ for today:
=== Is Sam Ruby happy? If not, make him happy.
+=== Are the postgres tests green? If not, make them green
+
=== Contact the security team. CVE emails must be sent on this day.
=== Create a release branch.
@@ -81,8 +89,20 @@ You can review the commits for the 3.0.10 release like this:
[aaron@higgins rails (3-0-10)]$ git log v3.0.9..
+If you're doing a stable branch release, you should also ensure that all of
+the CHANGELOG entries in the stable branch are also synced to the master
+branch.
+
=== Update the RAILS_VERSION file to include the RC.
+=== Build and test the gem.
+
+Run `rake install` to generate the gems and install them locally. Then try
+generating a new app and ensure that nothing explodes.
+
+This will stop you from looking silly when you push an RC to rubygems.org and
+then realise it is broken.
+
=== Release the gem.
IMPORTANT: Due to YAML parse problems on the rubygems.org server, it is safest
@@ -150,6 +170,7 @@ 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
+* Build and test the gem
* Release the gems
* Email security lists
* Email general announcement lists
@@ -184,3 +205,34 @@ There are two simple steps for fixing the CI:
2. Fix it
Repeat these steps until the CI is green.
+
+=== Manually trigger docs generation
+
+We have a post-receive hook in GitHub that calls the docs server on pushes.
+It triggers generation and publication of edge docs, updates the contrib app,
+and generates and publishes stable docs if a new stable tag is detected.
+
+The hook unfortunately is not invoked by tag pushing, so once the new stable
+tag has been pushed to origin, please run
+
+ curl -X POST -d '' http://rails-hooks.hashref.com/rails-master-hook
+
+You should see something like this:
+
+ Rails master hook tasks scheduled:
+
+ * updates the local checkout
+ * updates Rails Contributors
+ * generates and publishes edge docs
+
+ If a new stable tag is detected it also
+
+ * generates and publishes stable docs
+
+ This needs typically a few minutes.
+
+Note you do not need to specify the tag, the docs server figures it out.
+
+Also, don't worry if you call that multiple times or the hook is triggered
+again by some immediate regular push, if the scripts are running new calls
+are just queued (in a queue of size 1).
@@ -1,5 +1,9 @@
## Rails 3.2.0 (unreleased) ##
+* Refactor ActionDispatch::ShowExceptions. Controller is responsible for choice to show exceptions. *Sergey Nartimov*
+
+ It's possible to override +show_detailed_exceptions?+ in controllers to specify which requests should provide debugging information on errors.
+
* Responders now return 204 No Content for API requests without a response body (as in the new scaffold) *José Valim*
* Added ActionDispatch::RequestId middleware that'll make a unique X-Request-Id header available to the response and enables the ActionDispatch::Request#uuid method. This makes it easy to trace requests from end-to-end in the stack and to identify individual requests in mixed logs like Syslog *DHH*
@@ -62,8 +66,40 @@
persistent between requests so if you need to manipulate the environment
for your test you need to do it before the cookie jar is created.
+## Rails 3.1.3 (unreleased) ##
+
+* Fix using `tranlate` helper with a html translation which uses the `:count` option for
+ pluralization.
+
+ *Jon Leighton*
+
## Rails 3.1.2 (unreleased) ##
+* Fix XSS security vulnerability in the `translate` helper method. When using interpolation
+ in combination with HTML-safe translations, the interpolated input would not get HTML
+ escaped. *GH 3664*
+
+ Before:
+
+ translate('foo_html', :something => '<script>') # => "...<script>..."
+
+ After:
+
+ translate('foo_html', :something => '<script>') # => "...&lt;script&gt;..."
+
+ *Sergey Nartimov*
+
+* Upgrade sprockets dependency to ~> 2.1.0
+
+* Ensure that the format isn't applied twice to the cache key, else it becomes impossible
+ to target with expire_action.
+
+ *Christopher Meiklejohn*
+
+* Swallow error when can't unmarshall object from session.
+
+ *Bruno Zanchet*
+
* Implement a workaround for a bug in ruby-1.9.3p0 where an error would be raised
while attempting to convert a template from one encoding to another.
@@ -76,6 +112,8 @@
*Jon Leighton*
+* Ensure users upgrading from 3.0.x to 3.1.x will properly upgrade their flash object in session (issues #3298 and #2509)
+
## Rails 3.1.1 (unreleased) ##
* javascript_path and stylesheet_path now refer to /assets if asset pipelining
@@ -24,7 +24,7 @@ Gem::Specification.new do |s|
s.add_dependency('rack', '~> 1.3.5')
s.add_dependency('rack-test', '~> 0.6.1')
s.add_dependency('journey', '~> 1.0.0')
- s.add_dependency('sprockets', '~> 2.1.0.beta')
+ s.add_dependency('sprockets', '~> 2.1.1')
s.add_dependency('erubis', '~> 2.7.0')
s.add_development_dependency('tzinfo', '~> 0.3.29')
@@ -5,8 +5,8 @@ def self.with(routes)
Module.new do
define_method(:inherited) do |klass|
super(klass)
- if namespace = klass.parents.detect {|m| m.respond_to?(:_railtie) }
- klass.send(:include, namespace._railtie.routes.url_helpers)
+ if namespace = klass.parents.detect { |m| m.respond_to?(:railtie_routes_url_helpers) }
+ klass.send(:include, namespace.railtie_routes_url_helpers)
else
klass.send(:include, routes.url_helpers)
end
@@ -1,5 +1,6 @@
require 'active_support/core_ext/class/attribute'
require 'active_support/core_ext/object/blank'
+require 'set'
module ActionController
# See <tt>Renderers.add</tt>
@@ -12,16 +13,13 @@ module Renderers
included do
class_attribute :_renderers
- self._renderers = {}.freeze
+ self._renderers = Set.new.freeze
end
module ClassMethods
def use_renderers(*args)
- new = _renderers.dup
- args.each do |key|
- new[key] = RENDERERS[key]
- end
- self._renderers = new.freeze
+ renderers = _renderers + args
+ self._renderers = renderers.freeze
end
alias use_renderer use_renderers
end
@@ -31,18 +29,18 @@ def render_to_body(options)
end
def _handle_render_options(options)
- _renderers.each do |name, value|
- if options.key?(name.to_sym)
+ _renderers.each do |name|
+ if options.key?(name)
_process_options(options)
- return send("_render_option_#{name}", options.delete(name.to_sym), options)
+ return send("_render_option_#{name}", options.delete(name), options)
end
end
nil
end
# Hash of available renderers, mapping a renderer name to its proc.
# Default keys are :json, :js, :xml.
- RENDERERS = {}
+ RENDERERS = Set.new
# Adds a new renderer to call within controller actions.
# A renderer is invoked by passing its name as an option to
@@ -79,7 +77,7 @@ def _handle_render_options(options)
# <tt>ActionController::MimeResponds#respond_with</tt>
def self.add(key, &block)
define_method("_render_option_#{key}", &block)
- RENDERERS[key] = block
+ RENDERERS << key.to_sym
end
module All
@@ -3,6 +3,11 @@ module Rescue
extend ActiveSupport::Concern
include ActiveSupport::Rescuable
+ included do
+ config_accessor :consider_all_requests_local
+ self.consider_all_requests_local = false if consider_all_requests_local.nil?
+ end
+
def rescue_with_handler(exception)
if (exception.respond_to?(:original_exception) &&
(orig_exception = exception.original_exception) &&
@@ -12,10 +17,15 @@ def rescue_with_handler(exception)
super(exception)
end
+ def show_detailed_exceptions?
+ consider_all_requests_local || request.local?
+ end
+
private
def process_action(*args)
super
rescue Exception => exception
+ request.env['action_dispatch.show_detailed_exceptions'] = show_detailed_exceptions?
rescue_with_handler(exception) || raise(exception)
end
end
@@ -21,6 +21,8 @@ class Railtie < Rails::Railtie
paths = app.config.paths
options = app.config.action_controller
+ options.consider_all_requests_local ||= app.config.consider_all_requests_local
+
options.assets_dir ||= paths["public"].first
options.javascripts_dir ||= paths["public/javascripts"].first
options.stylesheets_dir ||= paths["public/stylesheets"].first
@@ -6,13 +6,14 @@ def self.with(app)
define_method(:inherited) do |klass|
super(klass)
- if namespace = klass.parents.detect {|m| m.respond_to?(:_railtie) }
- paths = namespace._railtie.paths["app/helpers"].existent
+ if namespace = klass.parents.detect { |m| m.respond_to?(:railtie_helpers_paths) }
+ paths = namespace.railtie_helpers_paths
else
- paths = app.config.helpers_paths
+ paths = app.helpers_paths
end
klass.helpers_path = paths
+
if klass.superclass == ActionController::Base && ActionController::Base.include_all_helpers
klass.helper :all
end
@@ -243,10 +243,13 @@ def recycle! #:nodoc:
@delete_cookies.clear
end
+ mattr_accessor :always_write_cookie
+ self.always_write_cookie = false
+
private
def write_cookie?(cookie)
- @secure || !cookie[:secure] || defined?(Rails.env) && Rails.env.development?
+ @secure || !cookie[:secure] || always_write_cookie
end
end
@@ -52,14 +52,9 @@ def parse_formatted_parameters(env)
false
end
rescue Exception => e # YAML, XML or Ruby code block errors
- logger.debug "Error occurred while parsing request parameters.\nContents:\n\n#{request.raw_post}"
+ logger(env).debug "Error occurred while parsing request parameters.\nContents:\n\n#{request.raw_post}"
- raise
- { "body" => request.raw_post,
- "content_type" => request.content_mime_type,
- "content_length" => request.content_length,
- "exception" => "#{e.message} (#{e.class})",
- "backtrace" => e.backtrace }
+ raise e
end
def content_type_from_legacy_post_data_format_header(env)
@@ -73,8 +68,8 @@ def content_type_from_legacy_post_data_format_header(env)
nil
end
- def logger
- defined?(Rails.logger) ? Rails.logger : Logger.new($stderr)
+ def logger(env)
+ env['action_dispatch.logger'] || Logger.new($stderr)
end
end
end
Oops, something went wrong.

0 comments on commit e2e2d62

Please sign in to comment.