Permalink
Browse files

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

  • Loading branch information...
2 parents d2c633b + 80e47d7 commit cd2bbed9846d84a1230a1b9e52843eedca17b28d @goncalossilva goncalossilva committed Jul 10, 2010
Showing with 1,978 additions and 1,080 deletions.
  1. +1 −0 .gitignore
  2. +2 −2 actionmailer/lib/action_mailer/base.rb
  3. +1 −0 actionmailer/test/base_test.rb
  4. +7 −5 actionmailer/test/old_base/url_test.rb
  5. +1 −1 actionpack/actionpack.gemspec
  6. +2 −2 actionpack/lib/abstract_controller/rendering.rb
  7. +0 −6 actionpack/lib/action_controller/base.rb
  8. +3 −2 actionpack/lib/action_controller/metal/helpers.rb
  9. +5 −5 actionpack/lib/action_controller/metal/url_for.rb
  10. +0 −1 actionpack/lib/action_controller/railtie.rb
  11. +5 −0 actionpack/lib/action_dispatch/middleware/session/abstract_store.rb
  12. +5 −7 actionpack/lib/action_dispatch/routing.rb
  13. +4 −4 actionpack/lib/action_dispatch/routing/deprecated_mapper.rb
  14. +84 −84 actionpack/lib/action_dispatch/routing/mapper.rb
  15. +41 −35 actionpack/lib/action_dispatch/routing/route_set.rb
  16. +1 −1 actionpack/lib/action_dispatch/routing/url_for.rb
  17. +1 −1 actionpack/lib/action_view/base.rb
  18. +11 −1 actionpack/lib/action_view/helpers/form_helper.rb
  19. +1 −1 actionpack/lib/action_view/helpers/url_helper.rb
  20. +5 −5 actionpack/lib/action_view/test_case.rb
  21. +1 −1 actionpack/test/abstract/helper_test.rb
  22. +14 −11 actionpack/test/abstract_unit.rb
  23. +3 −3 actionpack/test/controller/helper_test.rb
  24. +20 −0 actionpack/test/controller/mime_responds_test.rb
  25. +1 −1 actionpack/test/controller/url_for_test.rb
  26. +268 −9 actionpack/test/dispatch/routing_test.rb
  27. +22 −0 actionpack/test/dispatch/session/cookie_store_test.rb
  28. +8 −8 actionpack/test/dispatch/url_generation_test.rb
  29. +27 −2 actionpack/test/template/url_helper_test.rb
  30. +1 −0 activemodel/lib/active_model.rb
  31. +1 −0 activemodel/lib/active_model/errors.rb
  32. +160 −0 activemodel/lib/active_model/mass_assignment_security.rb
  33. +39 −0 activemodel/lib/active_model/mass_assignment_security/permission_set.rb
  34. +23 −0 activemodel/lib/active_model/mass_assignment_security/sanitizer.rb
  35. +2 −0 activemodel/lib/active_model/observing.rb
  36. +28 −0 activemodel/test/cases/mass_assignment_security/black_list_test.rb
  37. +30 −0 activemodel/test/cases/mass_assignment_security/permission_set_test.rb
  38. +37 −0 activemodel/test/cases/mass_assignment_security/sanitizer_test.rb
  39. +28 −0 activemodel/test/cases/mass_assignment_security/white_list_test.rb
  40. +52 −0 activemodel/test/cases/mass_assignment_security_test.rb
  41. +57 −0 activemodel/test/models/mass_assignment_specific.rb
  42. +6 −1 activerecord/lib/active_record/association_preload.rb
  43. +15 −4 activerecord/lib/active_record/associations.rb
  44. +10 −4 activerecord/lib/active_record/associations/association_collection.rb
  45. +23 −156 activerecord/lib/active_record/base.rb
  46. +7 −2 activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
  47. +12 −3 activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb
  48. +0 −19 activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb
  49. +13 −4 activerecord/lib/active_record/counter_cache.rb
  50. +1 −1 activerecord/lib/active_record/named_scope.rb
  51. +3 −3 activerecord/lib/active_record/observer.rb
  52. +14 −5 activerecord/lib/active_record/persistence.rb
  53. +1 −1 activerecord/lib/active_record/railties/databases.rake
  54. +1 −2 activerecord/lib/active_record/relation.rb
  55. +1 −1 activerecord/lib/active_record/relation/finder_methods.rb
  56. +19 −10 activerecord/lib/active_record/timestamp.rb
  57. +120 −0 activerecord/test/cases/adapters/sqlite/sqlite_adapter_test.rb
  58. +6 −0 activerecord/test/cases/associations/eager_test.rb
  59. +2 −2 activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb
  60. +5 −2 activerecord/test/cases/associations/has_many_associations_test.rb
  61. +0 −4 activerecord/test/cases/associations/has_one_through_associations_test.rb
  62. +10 −0 activerecord/test/cases/associations_test.rb
  63. +62 −131 activerecord/test/cases/base_test.rb
  64. +16 −3 activerecord/test/cases/counter_cache_test.rb
  65. +3 −4 activerecord/test/cases/dirty_test.rb
  66. +43 −0 activerecord/test/cases/mass_assignment_security_test.rb
  67. +14 −0 activerecord/test/cases/migration_test.rb
  68. +15 −9 activerecord/test/cases/nested_attributes_test.rb
  69. +4 −0 activerecord/test/fixtures/cars.yml
  70. +4 −0 activerecord/test/models/car.rb
  71. +1 −1 activerecord/test/models/category.rb
  72. +3 −0 activerecord/test/models/engine.rb
  73. +24 −0 activerecord/test/models/loose_person.rb
  74. +1 −0 activerecord/test/models/post.rb
  75. +3 −0 activerecord/test/models/wheel.rb
  76. +13 −0 activerecord/test/schema/schema.rb
  77. +0 −1 activesupport/lib/active_support/all.rb
  78. +2 −2 activesupport/lib/active_support/callbacks.rb
  79. +26 −31 activesupport/lib/active_support/core_ext/class/subclasses.rb
  80. +2 −1 activesupport/lib/active_support/core_ext/date/calculations.rb
  81. +3 −13 activesupport/lib/active_support/core_ext/date/conversions.rb
  82. +14 −0 activesupport/lib/active_support/core_ext/date/zones.rb
  83. +1 −0 activesupport/lib/active_support/core_ext/date_time/calculations.rb
  84. +1 −0 activesupport/lib/active_support/core_ext/date_time/conversions.rb
  85. +2 −0 activesupport/lib/active_support/core_ext/date_time/zones.rb
  86. +1 −1 activesupport/lib/active_support/core_ext/logger.rb
  87. +1 −1 activesupport/lib/active_support/core_ext/object.rb
  88. +0 −11 activesupport/lib/active_support/core_ext/object/extending.rb
  89. +19 −0 activesupport/lib/active_support/core_ext/object/to_json.rb
  90. +1 −1 activesupport/lib/active_support/core_ext/string/multibyte.rb
  91. +5 −0 activesupport/lib/active_support/core_ext/time/calculations.rb
  92. +0 −5 activesupport/lib/active_support/core_ext/time/zones.rb
  93. +3 −2 activesupport/lib/active_support/deprecation/behaviors.rb
  94. +3 −2 activesupport/lib/active_support/deprecation/reporting.rb
  95. +14 −10 activesupport/lib/active_support/descendants_tracker.rb
  96. +5 −6 activesupport/lib/active_support/file_update_checker.rb
  97. +1 −0 activesupport/lib/active_support/i18n_railtie.rb
  98. +10 −32 activesupport/lib/active_support/json/encoding.rb
  99. +2 −4 activesupport/lib/active_support/json/variable.rb
  100. +7 −19 activesupport/lib/active_support/multibyte/chars.rb
  101. +1 −0 activesupport/lib/active_support/time.rb
  102. +6 −6 activesupport/lib/active_support/values/time_zone.rb
  103. +19 −21 activesupport/test/core_ext/class_test.rb
  104. +0 −49 activesupport/test/core_ext/object_and_class_ext_test.rb
  105. +20 −0 activesupport/test/deprecation_test.rb
  106. +5 −3 activesupport/test/descendants_tracker_test.rb
  107. +4 −2 activesupport/test/json/encoding_test.rb
  108. +25 −16 activesupport/test/multibyte_chars_test.rb
  109. +1 −0 activesupport/test/ordered_hash_test.rb
  110. +1 −1 rails.gemspec
  111. +2 −2 railties/README
  112. +3 −1 railties/guides/source/3_0_release_notes.textile
  113. +2 −2 railties/guides/source/active_record_validations_callbacks.textile
  114. +31 −50 railties/guides/source/active_support_core_extensions.textile
  115. +10 −0 railties/guides/source/association_basics.textile
  116. +1 −1 railties/guides/source/getting_started.textile
  117. +1 −1 railties/guides/source/index.html.erb
  118. +110 −105 railties/guides/source/initialization.textile
  119. +1 −1 railties/guides/source/layouts_and_rendering.textile
  120. +1 −1 railties/guides/source/plugins.textile
  121. +19 −13 railties/guides/source/routing.textile
  122. +1 −1 railties/guides/source/security.textile
  123. +9 −14 railties/lib/rails/application.rb
  124. +5 −5 railties/lib/rails/commands.rb
  125. +1 −1 railties/lib/rails/commands/application.rb
  126. +57 −52 railties/lib/rails/commands/plugin.rb
  127. +1 −1 railties/lib/rails/commands/runner.rb
  128. +3 −0 railties/lib/rails/commands/server.rb
  129. +1 −1 railties/lib/rails/generators/actions.rb
  130. +1 −1 railties/lib/rails/generators/rails/app/templates/README
  131. +1 −1 railties/lib/rails/generators/rails/app/templates/Rakefile
  132. +3 −3 railties/lib/rails/generators/rails/app/templates/config/application.rb
  133. +1 −1 railties/lib/rails/generators/rails/app/templates/config/initializers/secret_token.rb.tt
  134. +2 −2 railties/lib/rails/generators/rails/app/templates/config/initializers/session_store.rb.tt
  135. +1 −1 railties/lib/rails/info_routes.rb
  136. +1 −1 railties/lib/rails/tasks/middleware.rake
  137. +1 −1 railties/lib/rails/tasks/routes.rake
  138. +1 −1 railties/railties.gemspec
  139. +20 −1 railties/test/application/initializers/frameworks_test.rb
  140. +1 −1 railties/test/application/initializers/i18n_test.rb
  141. +2 −2 railties/test/application/rake_test.rb
  142. +1 −1 railties/test/application/runner_test.rb
  143. +1 −1 railties/test/rails_info_controller_test.rb
View
@@ -1,6 +1,7 @@
*.gem
pkg
.bundle
+Gemfile.lock
debug.log
doc/rdoc
activemodel/doc
@@ -737,13 +737,13 @@ def deprecated_url_options
raise "You can no longer call ActionMailer::Base.default_url_options " \
"directly. You need to set config.action_mailer.default_url_options. " \
"If you are using ActionMailer standalone, you need to include the " \
- "url_helpers of a router directly."
+ "routing url_helpers directly."
end
end
# This module will complain if the user tries to set default_url_options
# directly instead of through the config object. In Action Mailer's Railtie,
- # we include the url_helpers of the router, which will override this module
+ # we include the router's url_helpers, which will override this module.
extend DeprecatedUrlOptions
ActiveSupport.run_load_hooks(:action_mailer, self)
@@ -1,5 +1,6 @@
# encoding: utf-8
require 'abstract_unit'
+require 'active_support/time'
class BaseTest < ActiveSupport::TestCase
# TODO Add some tests for implicity layout render and url helpers
@@ -28,7 +28,7 @@ def signed_up_with_url(recipient)
end
end
-class ActionMailerUrlTest < Test::Unit::TestCase
+class ActionMailerUrlTest < ActionMailer::TestCase
def encode( text, charset="UTF-8" )
quoted_printable( text, charset )
@@ -57,10 +57,12 @@ def teardown
def test_signed_up_with_url
UrlTestMailer.delivery_method = :test
-
- AppRoutes.draw do |map|
- map.connect ':controller/:action/:id'
- map.welcome 'welcome', :controller=>"foo", :action=>"bar"
+
+ assert_deprecated do
+ AppRoutes.draw do |map|
+ map.connect ':controller/:action/:id'
+ map.welcome 'welcome', :controller=>"foo", :action=>"bar"
+ end
end
expected = new_mail
@@ -27,5 +27,5 @@ Gem::Specification.new do |s|
s.add_dependency('rack-test', '~> 0.5.4')
#s.add_dependency('rack-mount', '~> 0.6.6')
s.add_dependency('tzinfo', '~> 0.3.16')
- s.add_dependency('erubis', '~> 2.6.5')
+ s.add_dependency('erubis', '~> 2.6.6')
end
@@ -50,8 +50,8 @@ def view_context_class
if controller.respond_to?(:_helpers)
include controller._helpers
- if controller.respond_to?(:_router)
- include controller._router.url_helpers
+ if controller.respond_to?(:_routes)
+ include controller._routes.url_helpers
end
# TODO: Fix RJS to not require this
@@ -60,17 +60,11 @@ def self.without_modules(*modules)
include ActionController::Compatibility
def self.inherited(klass)
- ::ActionController::Base.subclasses << klass.to_s
super
klass.helper :all
end
- def self.subclasses
- @subclasses ||= []
- end
-
config_accessor :asset_host, :asset_path
-
ActiveSupport.run_load_hooks(:action_controller, self)
end
end
@@ -1,3 +1,4 @@
+require 'active_support/core_ext/array/wrap'
require 'active_support/core_ext/class/attribute'
module ActionController
@@ -64,7 +65,7 @@ def helpers_dir
def helpers_dir=(value)
ActiveSupport::Deprecation.warn "helpers_dir= is deprecated, use helpers_path= instead", caller
- self.helpers_path = Array(value)
+ self.helpers_path = Array.wrap(value)
end
# Declares helper accessors for controller attributes. For example, the
@@ -103,7 +104,7 @@ def modules_for_helpers(args)
# Extract helper names from files in app/helpers/**/*_helper.rb
def all_application_helpers
helpers = []
- helpers_path.each do |path|
+ Array.wrap(helpers_path).each do |path|
extract = /^#{Regexp.quote(path.to_s)}\/?(.*)_helper.rb$/
helpers += Dir["#{path}/**/*_helper.rb"].map { |file| file.sub(extract, '\1') }
end
@@ -12,17 +12,17 @@ def url_options
).merge(:script_name => request.script_name)
end
- def _router
- raise "In order to use #url_for, you must include the helpers of a particular " \
- "router. For instance, `include Rails.application.routes.url_helpers"
+ def _routes
+ raise "In order to use #url_for, you must include routing helpers explicitly. " \
+ "For instance, `include Rails.application.routes.url_helpers"
end
module ClassMethods
def action_methods
@action_methods ||= begin
- super - _router.named_routes.helper_names
+ super - _routes.named_routes.helper_names
end
end
end
end
-end
+end
@@ -2,7 +2,6 @@
require "action_controller"
require "action_dispatch/railtie"
require "action_view/railtie"
-require "active_support/core_ext/class/subclasses"
require "active_support/deprecation/proxy_wrappers"
require "active_support/deprecation"
@@ -64,6 +64,11 @@ def []=(key, value)
super(key.to_s, value)
end
+ def clear
+ load_for_write!
+ super
+ end
+
def to_hash
load_for_read!
h = {}.replace(self)
@@ -31,7 +31,7 @@ module ActionDispatch
# Think of creating routes as drawing a map for your requests. The map tells
# them where to go based on some predefined pattern:
#
- # AppName::Applications.routes.draw do |map|
+ # AppName::Application.routes.draw do |map|
# Pattern 1 tells some request to go to one place
# Pattern 2 tell them to go to another
# ...
@@ -62,7 +62,7 @@ module ActionDispatch
#
# redirect_to show_item_path(:id => 25)
#
- # Use <tt>root</tt> as a shorthand to name a route for the root path "".
+ # Use <tt>root</tt> as a shorthand to name a route for the root path "/".
#
# # In routes.rb
# root :to => 'blogs#index'
@@ -72,7 +72,7 @@ module ActionDispatch
#
# # and provide these named routes
# root_url # => 'http://www.example.com/'
- # root_path # => ''
+ # root_path # => '/'
#
# Note: when using +controller+, the route is simply named after the
# method you call on the block parameter rather than map.
@@ -91,9 +91,7 @@ module ActionDispatch
#
# Routes can generate pretty URLs. For example:
#
- # match '/articles/:year/:month/:day', :constraints => {
- # :controller => 'articles',
- # :action => 'find_by_date',
+ # match '/articles/:year/:month/:day' => 'articles#find_by_id', :constraints => {
# :year => /\d{4}/,
# :month => /\d{1,2}/,
# :day => /\d{1,2}/
@@ -167,7 +165,7 @@ module ActionDispatch
#
# You can reload routes if you feel you must:
#
- # Rails::Application.reload_routes!
+ # Rails.application.reload_routes!
#
# This will clear all named routes and reload routes.rb if the file has been modified from
# last load. To absolutely force reloading, use <tt>reload!</tt>.
@@ -19,9 +19,9 @@ def controller_constraints
def in_memory_controller_namespaces
namespaces = Set.new
- ActionController::Base.subclasses.each do |klass|
- controller_name = klass.underscore
- namespaces << controller_name.split('/')[0...-1].join('/')
+ ActionController::Base.descendants.each do |klass|
+ next if klass.anonymous?
+ namespaces << klass.name.underscore.split('/')[0...-1].join('/')
end
namespaces.delete('')
namespaces
@@ -31,7 +31,7 @@ def in_memory_controller_namespaces
class DeprecatedMapper #:nodoc:
def initialize(set) #:nodoc:
ActiveSupport::Deprecation.warn "You are using the old router DSL which will be removed in Rails 3.1. " <<
- "Please check how to update your router file at: http://www.engineyard.com/blog/2010/the-lowdown-on-routes-in-rails-3/"
+ "Please check how to update your routes file at: http://www.engineyard.com/blog/2010/the-lowdown-on-routes-in-rails-3/"
@set = set
end
Oops, something went wrong.

0 comments on commit cd2bbed

Please sign in to comment.