Permalink
Browse files

Merge remote-tracking branch 'rails/master'

  • Loading branch information...
2 parents 000bebc + a769fe9 commit f87d362be2d3c39823268a19185bea22ead814aa @jeroeningen committed May 31, 2012
Showing with 3,457 additions and 1,001 deletions.
  1. +2 −4 Gemfile
  2. +10 −0 actionmailer/CHANGELOG.md
  3. +74 −0 actionpack/CHANGELOG.md
  4. +15 −7 actionpack/lib/action_controller/metal/force_ssl.rb
  5. +2 −2 actionpack/lib/action_controller/metal/helpers.rb
  6. +22 −0 actionpack/lib/action_dispatch/http/request.rb
  7. +1 −1 actionpack/lib/action_dispatch/routing/mapper.rb
  8. +7 −1 actionpack/lib/action_dispatch/routing/polymorphic_routes.rb
  9. +3 −7 actionpack/lib/action_dispatch/routing/route_set.rb
  10. +5 −2 actionpack/lib/action_dispatch/testing/integration.rb
  11. +31 −183 actionpack/lib/action_view/helpers/number_helper.rb
  12. +23 −11 actionpack/lib/action_view/helpers/text_helper.rb
  13. +31 −20 actionpack/lib/action_view/helpers/url_helper.rb
  14. +0 −98 actionpack/lib/action_view/locale/en.yml
  15. +1 −1 actionpack/lib/action_view/renderer/template_renderer.rb
  16. +2 −1 actionpack/lib/action_view/test_case.rb
  17. +1 −0 actionpack/test/abstract_unit.rb
  18. +27 −1 actionpack/test/activerecord/polymorphic_routes_test.rb
  19. +31 −0 actionpack/test/controller/force_ssl_test.rb
  20. +30 −0 actionpack/test/controller/helper_test.rb
  21. +19 −0 actionpack/test/controller/integration_test.rb
  22. +2 −2 actionpack/test/controller/request_forgery_protection_test.rb
  23. +6 −1 actionpack/test/dispatch/request/query_string_parsing_test.rb
  24. +5 −0 actionpack/test/fixtures/helpers1_pack/pack1_helper.rb
  25. +5 −0 actionpack/test/fixtures/helpers2_pack/pack2_helper.rb
  26. +11 −0 actionpack/test/template/number_helper_test.rb
  27. +19 −0 actionpack/test/template/test_case_test.rb
  28. +53 −14 actionpack/test/template/text_helper_test.rb
  29. +27 −0 actionpack/test/template/url_helper_test.rb
  30. +17 −0 activemodel/CHANGELOG.md
  31. +2 −2 activemodel/lib/active_model/translation.rb
  32. +1 −0 activemodel/lib/active_model/validations/validates.rb
  33. +5 −0 activemodel/test/cases/translation_test.rb
  34. +5 −0 activemodel/test/cases/validations_test.rb
  35. +47 −0 activerecord/CHANGELOG.md
  36. +4 −4 activerecord/README.rdoc
  37. +1 −0 activerecord/lib/active_record.rb
  38. +17 −2 activerecord/lib/active_record/associations/association_scope.rb
  39. +1 −0 activerecord/lib/active_record/associations/collection_association.rb
  40. +48 −1 activerecord/lib/active_record/associations/collection_proxy.rb
  41. +4 −3 activerecord/lib/active_record/attribute_methods/serialization.rb
  42. +3 −5 activerecord/lib/active_record/coders/yaml_column.rb
  43. +1 −0 activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb
  44. +0 −1 activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
  45. +4 −4 activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb
  46. +7 −7 activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
  47. +6 −8 activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb
  48. +5 −4 activerecord/lib/active_record/core.rb
  49. +7 −1 activerecord/lib/active_record/explain.rb
  50. +20 −24 activerecord/lib/active_record/fixtures/file.rb
  51. +1 −1 activerecord/lib/active_record/locking/optimistic.rb
  52. +0 −1 activerecord/lib/active_record/migration.rb
  53. +8 −9 activerecord/lib/active_record/null_relation.rb
  54. +6 −0 activerecord/lib/active_record/railtie.rb
  55. +18 −9 activerecord/lib/active_record/relation/batches.rb
  56. +15 −4 activerecord/lib/active_record/relation/calculations.rb
  57. +13 −12 activerecord/lib/active_record/relation/finder_methods.rb
  58. +1 −1 activerecord/lib/active_record/relation/predicate_builder.rb
  59. +1 −1 activerecord/lib/active_record/relation/query_methods.rb
  60. +32 −2 activerecord/lib/active_record/store.rb
  61. +27 −0 activerecord/test/cases/adapters/mysql2/connection_test.rb
  62. +44 −0 activerecord/test/cases/adapters/postgresql/connection_test.rb
  63. +21 −15 activerecord/test/cases/adapters/sqlite3/sqlite3_adapter_test.rb
  64. +17 −3 activerecord/test/cases/associations/has_many_associations_test.rb
  65. +21 −1 activerecord/test/cases/associations/join_model_test.rb
  66. +9 −0 activerecord/test/cases/base_test.rb
  67. +16 −0 activerecord/test/cases/calculations_test.rb
  68. +16 −0 activerecord/test/cases/helper.rb
  69. +19 −0 activerecord/test/cases/relation/where_test.rb
  70. +6 −1 activerecord/test/cases/relations_test.rb
  71. +16 −13 activerecord/test/cases/store_test.rb
  72. +3 −0 activerecord/test/fixtures/admin/users.yml
  73. +13 −1 activesupport/CHANGELOG.md
  74. +16 −3 activesupport/lib/active_support/callbacks.rb
  75. +16 −8 activesupport/lib/active_support/core_ext/array/access.rb
  76. +60 −5 activesupport/lib/active_support/core_ext/array/conversions.rb
  77. +7 −2 activesupport/lib/active_support/core_ext/big_decimal/conversions.rb
  78. +10 −4 activesupport/lib/active_support/core_ext/class/subclasses.rb
  79. +26 −8 activesupport/lib/active_support/core_ext/hash/keys.rb
  80. +10 −10 activesupport/lib/active_support/core_ext/module/attribute_accessors.rb
  81. +1 −0 activesupport/lib/active_support/core_ext/numeric.rb
  82. +135 −0 activesupport/lib/active_support/core_ext/numeric/conversions.rb
  83. +0 −2 activesupport/lib/active_support/core_ext/string/access.rb
  84. +1 −3 activesupport/lib/active_support/core_ext/string/filters.rb
  85. +5 −0 activesupport/lib/active_support/json/decoding.rb
  86. +13 −11 activesupport/lib/active_support/json/encoding.rb
  87. +0 −9 activesupport/lib/active_support/json/variable.rb
  88. +99 −0 activesupport/lib/active_support/locale/en.yml
  89. +1 −1 activesupport/lib/active_support/multibyte/chars.rb
  90. +531 −0 activesupport/lib/active_support/number_helper.rb
  91. +4 −4 activesupport/lib/active_support/testing/performance.rb
  92. +5 −0 activesupport/lib/active_support/testing/performance/ruby.rb
  93. +12 −0 activesupport/lib/active_support/testing/setup_and_teardown.rb
  94. +5 −0 activesupport/test/core_ext/bigdecimal_test.rb
  95. +3 −3 activesupport/test/core_ext/file_test.rb
  96. +3 −2 activesupport/test/core_ext/kernel_test.rb
  97. +1 −1 activesupport/test/core_ext/module_test.rb
  98. +261 −0 activesupport/test/core_ext/numeric_ext_test.rb
  99. +4 −0 activesupport/test/core_ext/string_ext_test.rb
  100. +6 −2 activesupport/test/json/encoding_test.rb
  101. +375 −0 activesupport/test/number_helper_test.rb
  102. +50 −8 activesupport/test/test_case_test.rb
  103. +40 −0 activesupport/test/testing/performance_test.rb
  104. +69 −9 guides/Rakefile
  105. +2 −7 guides/rails_guides/generator.rb
  106. +10 −12 guides/source/action_view_overview.textile
  107. +48 −0 guides/source/active_record_querying.textile
  108. +70 −0 guides/source/active_support_core_extensions.textile
  109. +2 −2 guides/source/active_support_instrumentation.textile
  110. +96 −102 guides/source/command_line.textile
  111. +36 −0 guides/source/contributing_to_ruby_on_rails.textile
  112. +6 −0 guides/source/engines.textile
  113. +32 −64 guides/source/initialization.textile
  114. +1 −2 guides/source/migrations.textile
  115. +18 −6 guides/source/ruby_on_rails_guides_guidelines.textile
  116. +45 −34 guides/source/security.textile
  117. +14 −6 guides/source/upgrading_ruby_on_rails.textile
  118. +2 −0 railties/CHANGELOG.md
  119. +12 −1 railties/lib/rails/application.rb
  120. +9 −2 railties/lib/rails/code_statistics.rb
  121. +9 −1 railties/lib/rails/commands.rb
  122. +25 −23 railties/lib/rails/commands/console.rb
  123. +75 −62 railties/lib/rails/commands/dbconsole.rb
  124. +1 −0 railties/lib/rails/commands/runner.rb
  125. +0 −5 railties/lib/rails/commands/server.rb
  126. +5 −0 railties/lib/rails/engine.rb
  127. +1 −1 railties/lib/rails/generators/app_base.rb
  128. +1 −1 railties/lib/rails/generators/rails/app/templates/Gemfile
  129. +1 −1 railties/lib/rails/generators/rails/controller/templates/controller.rb
  130. +1 −1 railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb
  131. +12 −1 railties/lib/rails/railtie.rb
  132. +1 −1 railties/lib/rails/tasks/documentation.rake
  133. +0 −2 railties/lib/rails/tasks/routes.rake
  134. +1 −0 railties/lib/rails/tasks/statistics.rake
  135. +3 −3 railties/test/application/configuration_test.rb
  136. +20 −20 railties/test/application/rake/notes_test.rb
  137. +23 −0 railties/test/application/rake_test.rb
  138. +10 −0 railties/test/application/runner_test.rb
  139. +62 −31 railties/test/commands/console_test.rb
  140. +16 −14 railties/test/commands/dbconsole_test.rb
  141. +2 −2 railties/test/commands/server_test.rb
  142. +1 −1 railties/test/generators/app_generator_test.rb
  143. +2 −2 railties/test/generators_test.rb
  144. +4 −0 railties/test/railties/engine_test.rb
  145. +16 −0 railties/test/railties/railtie_test.rb
View
@@ -8,10 +8,11 @@ else
gem 'arel'
end
+gem 'minitest', '~> 3.0.0'
+gem 'mocha', '>= 0.11.2'
gem 'rack-test', github: "brynary/rack-test"
gem 'bcrypt-ruby', '~> 3.0.0'
gem 'jquery-rails'
-gem 'minitest', '~> 3.0.0'
if ENV['JOURNEY']
gem 'journey', path: ENV['JOURNEY']
@@ -29,9 +30,6 @@ end
# it being automatically loaded by sprockets
gem 'uglifier', '>= 1.0.3', require: false
-gem 'rake', '>= 0.8.7'
-gem 'mocha', '>= 0.11.2'
-
group :doc do
# The current sdoc cannot generate GitHub links due
# to a bug, but the PR that fixes it has been there
View
@@ -1,3 +1,13 @@
+## Rails 3.2.5 (Jun 1, 2012) ##
+
+* No changes.
+
+
+## Rails 3.2.4 (May 31, 2012) ##
+
+* No changes.
+
+
## Rails 3.2.3 (March 30, 2012) ##
* Upgrade mail version to 2.4.3 *ML*
View
@@ -1,5 +1,47 @@
## Rails 4.0.0 (unreleased) ##
+* Allow to use mounted_helpers (helpers for accessing mounted engines) in ActionView::TestCase. *Piotr Sarnacki*
+
+* Include mounted_helpers (helpers for accessing mounted engines) in ActionDispatch::IntegrationTest by default. *Piotr Sarnacki*
+
+* Extracted redirect logic from `ActionController::ForceSSL::ClassMethods.force_ssl` into `ActionController::ForceSSL#force_ssl_redirect`
+
+ *Jeremy Friesen*
+
+* Make possible to use a block in button_to helper if button text is hard
+ to fit into the name parameter, e.g.:
+
+ <%= button_to [:make_happy, @user] do %>
+ Make happy <strong><%= @user.name %></strong>
+ <% end %>
+ # => "<form method="post" action="/users/1/make_happy" class="button_to">
+ # <div>
+ # <button type="submit">
+ # Make happy <strong>Name</strong>
+ # </button>
+ # </div>
+ # </form>"
+
+ *Sergey Nartimov*
+
+* change a way of ordering helpers from several directories. Previously,
+ when loading helpers from multiple paths, all of the helpers files were
+ gathered into one array an then they were sorted. Helpers from different
+ directories should not be mixed before loading them to make loading more
+ predictable. The most common use case for such behavior is loading helpers
+ from engines. When you load helpers from application and engine Foo, in
+ that order, first rails will load all of the helpers from application,
+ sorted alphabetically and then it will do the same for Foo engine.
+
+ *Piotr Sarnacki*
+
+* `truncate` now always returns an escaped HTMl-safe string. The option `:escape` can be used as
+ false to not escape the result.
+
+ *Li Ellis Gallardo + Rafael Mendonça França*
+
+* `truncate` now accepts a block to show extra content when the text is truncated. *Li Ellis Gallardo*
+
* Add `week_field`, `week_field_tag`, `month_field`, `month_field_tag`, `datetime_local_field`,
`datetime_local_field_tag`, `datetime_field` and `datetime_field_tag` helpers. *Carlos Galdino*
@@ -199,6 +241,38 @@
HTML5 `mark` element. *Brian Cardarella*
+## Rails 3.2.5 (Jun 1, 2012) ##
+
+* No changes.
+
+
+## Rails 3.2.4 (May 31, 2012) ##
+
+* Deprecate old APIs for highlight, excerpt and word_wrap *Jeremy Walker*
+
+* Deprecate `:disable_with` in favor of `'data-disable-with'` option for `button_to`, `button_tag` and `submit_tag` helpers.
+
+ *Carlos Galdino + Rafael Mendonça França*
+
+* Deprecate `:mouseover` option for `image_tag` helper. *Rafael Mendonça França*
+
+* Deprecate `button_to_function` and `link_to_function` helpers. *Rafael Mendonça França*
+
+* Don't break Haml with textarea newline fix. GH #393, #4000, #5190, #5191
+
+* Fix options handling on labels. GH #2492, #5614
+
+* Added config.action_view.embed_authenticity_token_in_remote_forms to deal
+ with regression from 16ee611fa
+
+* Set rendered_format when doing render :inline. GH #5632
+
+* Fix the redirect when it receive blocks with arity of 1. Closes #5677
+
+* Strip [nil] from parameters hash. Thanks to Ben Murphy for
+ reporting this! CVE-2012-2660
+
+
## Rails 3.2.3 (March 30, 2012) ##
* Add `config.action_view.embed_authenticity_token_in_remote_forms` (defaults to true) which allows to set if authenticity token will be included by default in remote forms. If you change it to false, you can still force authenticity token by passing `:authenticity_token => true` in form options *Piotr Sarnacki*
@@ -40,15 +40,23 @@ module ClassMethods
def force_ssl(options = {})
host = options.delete(:host)
before_filter(options) do
- unless request.ssl?
- redirect_options = {:protocol => 'https://', :status => :moved_permanently}
- redirect_options.merge!(:host => host) if host
- redirect_options.merge!(:params => request.query_parameters)
- flash.keep if respond_to?(:flash)
- redirect_to redirect_options
- end
+ force_ssl_redirect(host)
end
end
end
+
+ # Redirect the existing request to use the HTTPS protocol.
+ #
+ # ==== Parameters
+ # * <tt>host</tt> - Redirect to a different host name
+ def force_ssl_redirect(host = nil)
+ unless request.ssl?
+ redirect_options = {:protocol => 'https://', :status => :moved_permanently}
+ redirect_options.merge!(:host => host) if host
+ redirect_options.merge!(:params => request.query_parameters)
+ flash.keep if respond_to?(:flash)
+ redirect_to redirect_options
+ end
+ end
end
end
@@ -95,9 +95,9 @@ def all_helpers_from_path(path)
helpers = []
Array(path).each do |_path|
extract = /^#{Regexp.quote(_path.to_s)}\/?(.*)_helper.rb$/
- helpers += Dir["#{_path}/**/*_helper.rb"].map { |file| file.sub(extract, '\1') }
+ names = Dir["#{_path}/**/*_helper.rb"].map { |file| file.sub(extract, '\1') }
+ helpers += names.sort
end
- helpers.sort!
helpers.uniq!
helpers
end
@@ -263,6 +263,28 @@ def local?
LOCALHOST =~ remote_addr && LOCALHOST =~ remote_ip
end
+ protected
+
+ # Remove nils from the params hash
+ def deep_munge(hash)
+ hash.each_value do |v|
+ case v
+ when Array
+ v.grep(Hash) { |x| deep_munge(x) }
+ when Hash
+ deep_munge(v)
+ end
+ end
+
+ keys = hash.keys.find_all { |k| hash[k] == [nil] }
+ keys.each { |k| hash[k] = nil }
+ hash
+ end
+
+ def parse_query(qs)
+ deep_munge(super)
+ end
+
private
def check_method(name)
@@ -1327,7 +1327,7 @@ def draw(name)
msg += @draw_paths.map { |_path| " * #{_path}" }.join("\n")
raise ArgumentError, msg
end
-
+
route_path = "#{path}/#{name}.rb"
instance_eval(File.read(route_path), route_path.to_s)
end
@@ -95,7 +95,7 @@ def polymorphic_url(record_or_hash_or_array, options = {})
end
record = extract_record(record_or_hash_or_array)
- record = record.to_model if record.respond_to?(:to_model)
+ record = convert_to_model(record)
args = Array === record_or_hash_or_array ?
record_or_hash_or_array.dup :
@@ -122,6 +122,8 @@ def polymorphic_url(record_or_hash_or_array, options = {})
args.last.kind_of?(Hash) ? args.last.merge!(url_options) : args << url_options
end
+ args.collect! { |a| convert_to_model(a) }
+
(proxy || self).send(named_route, *args)
end
@@ -152,6 +154,10 @@ def action_prefix(options)
options[:action] ? "#{options[:action]}_" : ''
end
+ def convert_to_model(object)
+ object.respond_to?(:to_model) ? object.to_model : object
+ end
+
def routing_type(options)
options[:routing_type] || :url
end
@@ -252,15 +252,11 @@ def initialize(request_class = ActionDispatch::Request)
self.draw_paths = []
self.request_class = request_class
- @valid_conditions = {}
-
+ @valid_conditions = { :controller => true, :action => true }
request_class.public_instance_methods.each { |m|
- @valid_conditions[m.to_sym] = true
+ @valid_conditions[m] = true
}
- @valid_conditions[:controller] = true
- @valid_conditions[:action] = true
-
- self.valid_conditions.delete(:id)
+ @valid_conditions.delete(:id)
@append = []
@prepend = []
@@ -193,8 +193,11 @@ def initialize(app)
# If the app is a Rails app, make url_helpers available on the session
# This makes app.url_for and app.foo_path available in the console
- if app.respond_to?(:routes) && app.routes.respond_to?(:url_helpers)
- singleton_class.class_eval { include app.routes.url_helpers }
+ if app.respond_to?(:routes)
+ singleton_class.class_eval do
+ include app.routes.url_helpers if app.routes.respond_to?(:url_helpers)
+ include app.routes.mounted_helpers if app.routes.respond_to?(:mounted_helpers)
+ end
end
reset!
Oops, something went wrong.

0 comments on commit f87d362

Please sign in to comment.