Permalink
Browse files

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

  • Loading branch information...
Neeraj Singh
Neeraj Singh committed Jul 8, 2010
2 parents f6fa6cf + dc364fd commit 4a1207d54077348b67fad95ffde5710cf0be31bd
Showing with 855 additions and 545 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. +5 −5 actionpack/lib/action_controller/metal/url_for.rb
  9. +0 −1 actionpack/lib/action_controller/railtie.rb
  10. +5 −0 actionpack/lib/action_dispatch/middleware/session/abstract_store.rb
  11. +5 −7 actionpack/lib/action_dispatch/routing.rb
  12. +4 −4 actionpack/lib/action_dispatch/routing/deprecated_mapper.rb
  13. +84 −84 actionpack/lib/action_dispatch/routing/mapper.rb
  14. +41 −35 actionpack/lib/action_dispatch/routing/route_set.rb
  15. +1 −1 actionpack/lib/action_dispatch/routing/url_for.rb
  16. +1 −1 actionpack/lib/action_view/base.rb
  17. +1 −1 actionpack/lib/action_view/helpers/url_helper.rb
  18. +5 −5 actionpack/lib/action_view/test_case.rb
  19. +14 −11 actionpack/test/abstract_unit.rb
  20. +20 −0 actionpack/test/controller/mime_responds_test.rb
  21. +1 −1 actionpack/test/controller/url_for_test.rb
  22. +268 −9 actionpack/test/dispatch/routing_test.rb
  23. +22 −0 actionpack/test/dispatch/session/cookie_store_test.rb
  24. +8 −8 actionpack/test/dispatch/url_generation_test.rb
  25. +27 −2 actionpack/test/template/url_helper_test.rb
  26. +1 −0 activemodel/lib/active_model/errors.rb
  27. +11 −4 activerecord/lib/active_record/associations.rb
  28. +6 −1 activerecord/lib/active_record/associations/association_collection.rb
  29. +6 −5 activerecord/lib/active_record/base.rb
  30. +1 −1 activerecord/lib/active_record/named_scope.rb
  31. +3 −3 activerecord/lib/active_record/observer.rb
  32. +1 −1 activerecord/lib/active_record/railties/databases.rake
  33. +6 −0 activerecord/test/cases/nested_attributes_test.rb
  34. +0 −1 activesupport/lib/active_support/all.rb
  35. +2 −2 activesupport/lib/active_support/callbacks.rb
  36. +26 −31 activesupport/lib/active_support/core_ext/class/subclasses.rb
  37. +2 −1 activesupport/lib/active_support/core_ext/date/calculations.rb
  38. +3 −13 activesupport/lib/active_support/core_ext/date/conversions.rb
  39. +14 −0 activesupport/lib/active_support/core_ext/date/zones.rb
  40. +1 −0 activesupport/lib/active_support/core_ext/date_time/calculations.rb
  41. +1 −0 activesupport/lib/active_support/core_ext/date_time/conversions.rb
  42. +2 −0 activesupport/lib/active_support/core_ext/date_time/zones.rb
  43. +1 −1 activesupport/lib/active_support/core_ext/object.rb
  44. +0 −11 activesupport/lib/active_support/core_ext/object/extending.rb
  45. +19 −0 activesupport/lib/active_support/core_ext/object/to_json.rb
  46. +5 −0 activesupport/lib/active_support/core_ext/time/calculations.rb
  47. +0 −5 activesupport/lib/active_support/core_ext/time/zones.rb
  48. +3 −2 activesupport/lib/active_support/deprecation/behaviors.rb
  49. +3 −2 activesupport/lib/active_support/deprecation/reporting.rb
  50. +14 −10 activesupport/lib/active_support/descendants_tracker.rb
  51. +5 −6 activesupport/lib/active_support/file_update_checker.rb
  52. +1 −0 activesupport/lib/active_support/i18n_railtie.rb
  53. +10 −32 activesupport/lib/active_support/json/encoding.rb
  54. +2 −4 activesupport/lib/active_support/json/variable.rb
  55. +1 −0 activesupport/lib/active_support/time.rb
  56. +6 −6 activesupport/lib/active_support/values/time_zone.rb
  57. +19 −21 activesupport/test/core_ext/class_test.rb
  58. +0 −49 activesupport/test/core_ext/object_and_class_ext_test.rb
  59. +20 −0 activesupport/test/deprecation_test.rb
  60. +5 −3 activesupport/test/descendants_tracker_test.rb
  61. +4 −2 activesupport/test/json/encoding_test.rb
  62. +1 −0 activesupport/test/ordered_hash_test.rb
  63. +1 −1 rails.gemspec
  64. +29 −52 railties/guides/source/active_support_core_extensions.textile
  65. +10 −0 railties/guides/source/association_basics.textile
  66. +29 −49 railties/guides/source/initialization.textile
  67. +6 −0 railties/guides/source/routing.textile
  68. +9 −14 railties/lib/rails/application.rb
  69. +5 −5 railties/lib/rails/commands.rb
  70. +1 −1 railties/lib/rails/commands/application.rb
  71. +1 −1 railties/lib/rails/commands/runner.rb
  72. +1 −1 railties/lib/rails/generators/rails/app/templates/Rakefile
  73. +1 −1 railties/lib/rails/generators/rails/app/templates/config/initializers/secret_token.rb.tt
  74. +2 −2 railties/lib/rails/generators/rails/app/templates/config/initializers/session_store.rb.tt
  75. +1 −1 railties/lib/rails/info_routes.rb
  76. +1 −1 railties/lib/rails/tasks/middleware.rake
  77. +1 −1 railties/lib/rails/tasks/routes.rake
  78. +1 −1 railties/railties.gemspec
  79. +20 −1 railties/test/application/initializers/frameworks_test.rb
  80. +1 −1 railties/test/application/initializers/i18n_test.rb
  81. +2 −2 railties/test/application/rake_test.rb
  82. +1 −1 railties/test/application/runner_test.rb
  83. +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
@@ -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 4a1207d

Please sign in to comment.