Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'master' of http://github.com/rails/rails
  • Loading branch information
goncalossilva committed Jul 10, 2010
2 parents d2c633b + 80e47d7 commit cd2bbed
Show file tree
Hide file tree
Showing 143 changed files with 1,978 additions and 1,080 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -1,6 +1,7 @@
*.gem
pkg
.bundle
Gemfile.lock
debug.log
doc/rdoc
activemodel/doc
Expand Down
4 changes: 2 additions & 2 deletions actionmailer/lib/action_mailer/base.rb
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions actionmailer/test/base_test.rb
@@ -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
Expand Down
12 changes: 7 additions & 5 deletions actionmailer/test/old_base/url_test.rb
Expand Up @@ -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 )
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion actionpack/actionpack.gemspec
Expand Up @@ -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
4 changes: 2 additions & 2 deletions actionpack/lib/abstract_controller/rendering.rb
Expand Up @@ -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
Expand Down
6 changes: 0 additions & 6 deletions actionpack/lib/action_controller/base.rb
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions actionpack/lib/action_controller/metal/helpers.rb
@@ -1,3 +1,4 @@
require 'active_support/core_ext/array/wrap'
require 'active_support/core_ext/class/attribute'

module ActionController
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions actionpack/lib/action_controller/metal/url_for.rb
Expand Up @@ -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
1 change: 0 additions & 1 deletion actionpack/lib/action_controller/railtie.rb
Expand Up @@ -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"

Expand Down
Expand Up @@ -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)
Expand Down
12 changes: 5 additions & 7 deletions actionpack/lib/action_dispatch/routing.rb
Expand Up @@ -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
# ...
Expand Down Expand Up @@ -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'
Expand All @@ -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.
Expand All @@ -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}/
Expand Down Expand Up @@ -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>.
Expand Down
8 changes: 4 additions & 4 deletions actionpack/lib/action_dispatch/routing/deprecated_mapper.rb
Expand Up @@ -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
Expand All @@ -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

Expand Down

0 comments on commit cd2bbed

Please sign in to comment.