Skip to content

Commit

Permalink
Merge branch 'master' of github.com:lifo/docrails
Browse files Browse the repository at this point in the history
  • Loading branch information
twinturbo committed Apr 29, 2012
2 parents 2c136ae + 6659252 commit d7532c1
Show file tree
Hide file tree
Showing 426 changed files with 6,391 additions and 5,055 deletions.
8 changes: 7 additions & 1 deletion Gemfile
Expand Up @@ -18,12 +18,18 @@ else
gem 'journey', :git => "git://github.com/rails/journey"
end

if ENV['AR_DEPRECATED_FINDERS']
gem 'active_record_deprecated_finders', path: ENV['AR_DEPRECATED_FINDERS']
else
gem 'active_record_deprecated_finders', git: 'git://github.com/rails/active_record_deprecated_finders'
end

# This needs to be with require false to avoid
# it being automatically loaded by sprockets
gem 'uglifier', '>= 1.0.3', :require => false

gem 'rake', '>= 0.8.7'
gem 'mocha', '>= 0.9.8'
gem 'mocha', '>= 0.11.2'

group :doc do
# The current sdoc cannot generate GitHub links due
Expand Down
2 changes: 1 addition & 1 deletion actionmailer/CHANGELOG.md
@@ -1,4 +1,4 @@
## Rails 3.2.3 (unreleased) ##
## Rails 3.2.3 (March 30, 2012) ##

* Upgrade mail version to 2.4.3 *ML*

Expand Down
6 changes: 3 additions & 3 deletions actionmailer/README.rdoc
Expand Up @@ -22,12 +22,12 @@ the email.
This can be as simple as:

class Notifier < ActionMailer::Base
delivers_from 'system@loudthinking.com'
default from: 'system@loudthinking.com'

def welcome(recipient)
@recipient = recipient
mail(:to => recipient,
:subject => "[Signed up] Welcome #{recipient}")
mail(to: recipient,
subject: "[Signed up] Welcome #{recipient}")
end
end

Expand Down
6 changes: 3 additions & 3 deletions actionmailer/lib/action_mailer/base.rb
Expand Up @@ -486,7 +486,7 @@ def mailer_name
self.class.mailer_name
end

# Allows you to pass random and unusual headers to the new +Mail::Message+ object
# Allows you to pass random and unusual headers to the new <tt>Mail::Message</tt> object
# which will add them to itself.
#
# headers['X-Special-Domain-Specific-Header'] = "SecretValue"
Expand All @@ -497,7 +497,7 @@ def mailer_name
# headers 'X-Special-Domain-Specific-Header' => "SecretValue",
# 'In-Reply-To' => incoming.message_id
#
# The resulting Mail::Message will have the following in it's header:
# The resulting Mail::Message will have the following in its header:
#
# X-Special-Domain-Specific-Header: SecretValue
def headers(args=nil)
Expand Down Expand Up @@ -696,7 +696,7 @@ def set_content_type(m, user_content_type, class_default)
# If it does not find a translation for the +subject+ under the specified scope it will default to a
# humanized version of the <tt>action_name</tt>.
def default_i18n_subject #:nodoc:
mailer_scope = self.class.mailer_name.gsub('/', '.')
mailer_scope = self.class.mailer_name.tr('/', '.')
I18n.t(:subject, :scope => [mailer_scope, action_name], :default => action_name.humanize)
end

Expand Down
Expand Up @@ -6,7 +6,7 @@ class <%= class_name %> < ActionMailer::Base
# Subject can be set in your I18n file at config/locales/en.yml
# with the following lookup:
#
# en.<%= file_path.gsub("/",".") %>.<%= action %>.subject
# en.<%= file_path.tr("/",".") %>.<%= action %>.subject
#
def <%= action %>
@greeting = "Hi"
Expand Down
2 changes: 1 addition & 1 deletion actionmailer/test/i18n_with_controller_test.rb
Expand Up @@ -24,7 +24,7 @@ def send_mail
class ActionMailerI18nWithControllerTest < ActionDispatch::IntegrationTest
Routes = ActionDispatch::Routing::RouteSet.new
Routes.draw do
match ':controller(/:action(/:id))'
get ':controller(/:action(/:id))'
end

def app
Expand Down
4 changes: 2 additions & 2 deletions actionmailer/test/url_test.rb
Expand Up @@ -57,8 +57,8 @@ def test_signed_up_with_url
UrlTestMailer.delivery_method = :test

AppRoutes.draw do
match ':controller(/:action(/:id))'
match '/welcome' => "foo#bar", :as => "welcome"
get ':controller(/:action(/:id))'
get '/welcome' => "foo#bar", :as => "welcome"
end

expected = new_mail
Expand Down
13 changes: 12 additions & 1 deletion actionpack/CHANGELOG.md
@@ -1,5 +1,14 @@
## Rails 4.0.0 (unreleased) ##

* Add `index` method to FormBuilder class. *Jorge Bejar*

* Remove the leading \n added by textarea on assert_select. *Santiago Pastorino*

* Changed default value for `config.action_view.embed_authenticity_token_in_remote_forms`
to `false`. This change breaks remote forms that need to work also without javascript,
so if you need such behavior, you can either set it to `true` or explicitly pass
`:authenticity_token => true` in form options

* Added ActionDispatch::SSL middleware that when included force all the requests to be under HTTPS protocol. *Rafael Mendonça França*

* Add `include_hidden` option to select tag. With `:include_hidden => false` select with `multiple` attribute doesn't generate hidden input with blank value. *Vasiliy Ermolovich*
Expand Down Expand Up @@ -126,7 +135,9 @@
HTML5 `mark` element. *Brian Cardarella*


## Rails 3.2.3 (unreleased) ##
## 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*

* Do not include the authenticity token in forms where remote: true as ajax forms use the meta-tag value *DHH*

Expand Down
2 changes: 1 addition & 1 deletion actionpack/lib/abstract_controller/asset_paths.rb
@@ -1,5 +1,5 @@
module AbstractController
module AssetPaths
module AssetPaths #:nodoc:
extend ActiveSupport::Concern

included do
Expand Down
7 changes: 5 additions & 2 deletions actionpack/lib/abstract_controller/base.rb
Expand Up @@ -5,8 +5,11 @@
require 'active_support/core_ext/module/anonymous'

module AbstractController
class Error < StandardError; end
class ActionNotFound < StandardError; end
class Error < StandardError #:nodoc:
end

class ActionNotFound < StandardError #:nodoc:
end

# <tt>AbstractController::Base</tt> is a low-level API. Nobody should be
# using it directly, and subclasses (like ActionController::Base) are
Expand Down
1 change: 1 addition & 0 deletions actionpack/lib/abstract_controller/layouts.rb
Expand Up @@ -249,6 +249,7 @@ def conditional_layout?
# Symbol:: call the method specified by the symbol, which will return the template name
# false:: There is no layout
# true:: raise an ArgumentError
# nil:: Force default layout behavior with inheritance
#
# ==== Parameters
# * <tt>layout</tt> - The layout to use.
Expand Down
2 changes: 1 addition & 1 deletion actionpack/lib/abstract_controller/logger.rb
@@ -1,7 +1,7 @@
require "active_support/benchmarkable"

module AbstractController
module Logger
module Logger #:nodoc:
extend ActiveSupport::Concern

included do
Expand Down
2 changes: 1 addition & 1 deletion actionpack/lib/action_controller/caching/sweeping.rb
Expand Up @@ -93,7 +93,7 @@ def callback(timing)
end

def method_missing(method, *arguments, &block)
super unless @controller
return super unless @controller
@controller.__send__(method, *arguments, &block)
end
end
Expand Down
26 changes: 23 additions & 3 deletions actionpack/lib/action_controller/metal/data_streaming.rb
Expand Up @@ -16,7 +16,7 @@ module DataStreaming
protected
# Sends the file. This uses a server-appropriate method (such as X-Sendfile)
# via the Rack::Sendfile middleware. The header to use is set via
# config.action_dispatch.x_sendfile_header.
# +config.action_dispatch.x_sendfile_header+.
# Your server can also configure this for you by setting the X-Sendfile-Type header.
#
# Be careful to sanitize the path parameter if it is coming from a web
Expand Down Expand Up @@ -74,7 +74,27 @@ def send_file(path, options = {}) #:doc:

self.status = options[:status] || 200
self.content_type = options[:content_type] if options.key?(:content_type)
self.response_body = File.open(path, "rb")
self.response_body = FileBody.new(path)
end

# Avoid having to pass an open file handle as the response body.
# Rack::Sendfile will usually intercepts the response and just uses
# the path directly, so no reason to open the file.
class FileBody #:nodoc:
attr_reader :to_path

def initialize(path)
@to_path = path
end

# Stream the file's contents if Rack::Sendfile isn't present.
def each
File.open(to_path, 'rb') do |file|
while chunk = file.read(16384)
yield chunk
end
end
end
end

# Sends the given binary data to the browser. This method is similar to
Expand Down Expand Up @@ -132,7 +152,7 @@ def send_file_headers!(options)
else
if !type_provided && options[:filename]
# If type wasn't provided, try guessing from file extension.
content_type = Mime::Type.lookup_by_extension(File.extname(options[:filename]).downcase.tr('.','')) || content_type
content_type = Mime::Type.lookup_by_extension(File.extname(options[:filename]).downcase.delete('.')) || content_type
end
self.content_type = content_type
end
Expand Down
5 changes: 0 additions & 5 deletions actionpack/lib/action_controller/metal/exceptions.rb
Expand Up @@ -14,8 +14,6 @@ def initialize(message, failures=[])
end

class MethodNotAllowed < ActionControllerError #:nodoc:
attr_reader :allowed_methods

def initialize(*allowed_methods)
super("Only #{allowed_methods.to_sentence(:locale => :en)} requests are allowed.")
end
Expand All @@ -30,9 +28,6 @@ class UnknownController < ActionControllerError #:nodoc:
class MissingFile < ActionControllerError #:nodoc:
end

class RenderError < ActionControllerError #:nodoc:
end

class SessionOverflowError < ActionControllerError #:nodoc:
DEFAULT_MESSAGE = 'Your session data is larger than the data column in which it is to be stored. You must increase the size of your data column if you intend to store large data.'

Expand Down
Expand Up @@ -229,7 +229,7 @@ def decode_credentials_header(request)
def decode_credentials(header)
Hash[header.to_s.gsub(/^Digest\s+/,'').split(',').map do |pair|
key, value = pair.split('=', 2)
[key.strip.to_sym, value.to_s.gsub(/^"|"$/,'').gsub(/'/, '')]
[key.strip.to_sym, value.to_s.gsub(/^"|"$/,'').delete('\'')]
end]
end

Expand Down
4 changes: 2 additions & 2 deletions actionpack/lib/action_controller/metal/mime_responds.rb
Expand Up @@ -74,7 +74,7 @@ def clear_respond_to
#
# respond_to do |format|
# format.html
# format.xml { render :xml => @people.to_xml }
# format.xml { render :xml => @people }
# end
# end
#
Expand Down Expand Up @@ -389,7 +389,7 @@ def retrieve_collector_from_mimes(mimes=nil, &block) #:nodoc:
#
# respond_to do |format|
# format.html
# format.xml { render :xml => @people.to_xml }
# format.xml { render :xml => @people }
# end
#
# In this usage, the argument passed to the block (+format+ above) is an
Expand Down
4 changes: 2 additions & 2 deletions actionpack/lib/action_controller/metal/params_wrapper.rb
Expand Up @@ -48,7 +48,7 @@ module ActionController
# method attribute_names.
#
# If you're going to pass the parameters to an +ActiveModel+ object (such as
# +User.new(params[:user])+), you might consider passing the model class to
# <tt>User.new(params[:user])</tt>), you might consider passing the model class to
# the method instead. The +ParamsWrapper+ will actually try to determine the
# list of attribute names from the model and only wrap those attributes:
#
Expand All @@ -66,7 +66,7 @@ module ActionController
# class Admin::UsersController < ApplicationController
# end
#
# will try to check if +Admin::User+ or +User+ model exists, and use it to
# will try to check if <tt>Admin::User</tt> or +User+ model exists, and use it to
# determine the wrapper key respectively. If both models don't exist,
# it will then fallback to use +user+ as the key.
module ParamsWrapper
Expand Down
2 changes: 1 addition & 1 deletion actionpack/lib/action_controller/metal/redirecting.rb
Expand Up @@ -93,7 +93,7 @@ def _compute_redirect_to_location(options)
_compute_redirect_to_location options.call
else
url_for(options)
end.gsub(/[\0\r\n]/, '')
end.delete("\0\r\n")
end
end
end
2 changes: 1 addition & 1 deletion actionpack/lib/action_controller/metal/responder.rb
Expand Up @@ -63,7 +63,7 @@ module ActionController #:nodoc:
#
# def create
# @project = Project.find(params[:project_id])
# @task = @project.comments.build(params[:task])
# @task = @project.tasks.build(params[:task])
# flash[:notice] = 'Task was successfully created.' if @task.save
# respond_with(@project, @task)
# end
Expand Down
8 changes: 4 additions & 4 deletions actionpack/lib/action_controller/metal/streaming.rb
Expand Up @@ -139,17 +139,17 @@ module ActionController #:nodoc:
# session or flash after the template starts rendering will not propagate
# to the client.
#
# If you try to modify cookies, session or flash, an +ActionDispatch::ClosedError+
# If you try to modify cookies, session or flash, an <tt>ActionDispatch::ClosedError</tt>
# will be raised, showing those objects are closed for modification.
#
# == Middlewares
#
# Middlewares that need to manipulate the body won't work with streaming.
# You should disable those middlewares whenever streaming in development
# or production. For instance, +Rack::Bug+ won't work when streaming as it
# or production. For instance, <tt>Rack::Bug</tt> won't work when streaming as it
# needs to inject contents in the HTML body.
#
# Also +Rack::Cache+ won't work with streaming as it does not support
# Also <tt>Rack::Cache</tt> won't work with streaming as it does not support
# streaming bodies yet. Whenever streaming Cache-Control is automatically
# set to "no-cache".
#
Expand All @@ -162,7 +162,7 @@ module ActionController #:nodoc:
# Currently, when an exception happens in development or production, Rails
# will automatically stream to the client:
#
# "><script type="text/javascript">window.location = "/500.html"</script></html>
# "><script>window.location = "/500.html"</script></html>
#
# The first two characters (">) are required in case the exception happens
# while rendering attributes for a given tag. You can check the real cause
Expand Down
1 change: 1 addition & 0 deletions actionpack/lib/action_controller/record_identifier.rb
Expand Up @@ -53,6 +53,7 @@ def dom_class(record_or_class, prefix = nil)
# If you need to address multiple instances of the same class in the same view, you can prefix the dom_id:
#
# dom_id(Post.find(45), :edit) # => "edit_post_45"
# dom_id(Post.new, :custom) # => "custom_post"
def dom_id(record, prefix = nil)
if record_id = record_key_for_dom_id(record)
"#{dom_class(record, prefix)}#{JOIN}#{record_id}"
Expand Down
9 changes: 3 additions & 6 deletions actionpack/lib/action_controller/test_case.rb
Expand Up @@ -27,13 +27,13 @@ def setup_subscriptions
path = payload[:virtual_path]
next unless path
partial = path =~ /^.*\/_[^\/]*$/

if partial
@partials[path] += 1
@partials[path.split("/").last] += 1
@templates[path] += 1
else
@templates[path] += 1
end

@templates[path] += 1
end
end

Expand Down Expand Up @@ -140,9 +140,6 @@ def initialize(env = {})

class Result < ::Array #:nodoc:
def to_s() join '/' end
def self.new_escaped(strings)
new strings.collect {|str| uri_parser.unescape str}
end
end

def assign_parameters(routes, controller_path, action, parameters = {})
Expand Down
Expand Up @@ -99,7 +99,7 @@ class WhiteListSanitizer < Sanitizer
self.allowed_protocols = Set.new(%w(ed2k ftp http https irc mailto news gopher nntp telnet webcal xmpp callto
feed svn urn aim rsync tag ssh sftp rtsp afs))

# Specifies the default Set of acceptable css keywords that #sanitize and #sanitize_css will accept.
# Specifies the default Set of acceptable css properties that #sanitize and #sanitize_css will accept.
self.allowed_css_properties = Set.new(%w(azimuth background-color border-bottom-color border-collapse
border-color border-left-color border-right-color border-top-color clear color cursor direction display
elevation float font font-family font-size font-style font-variant font-weight height letter-spacing line-height
Expand Down
2 changes: 2 additions & 0 deletions actionpack/lib/action_dispatch/http/mime_negotiation.rb
@@ -1,3 +1,5 @@
require 'active_support/core_ext/module/attribute_accessors'

module ActionDispatch
module Http
module MimeNegotiation
Expand Down
2 changes: 1 addition & 1 deletion actionpack/lib/action_dispatch/http/mime_type.rb
Expand Up @@ -38,7 +38,7 @@ def self.[](type)
# respond_to do |format|
# format.html
# format.ics { render :text => post.to_ics, :mime_type => Mime::Type["text/calendar"] }
# format.xml { render :xml => @people.to_xml }
# format.xml { render :xml => @people }
# end
# end
# end
Expand Down
2 changes: 1 addition & 1 deletion actionpack/lib/action_dispatch/http/response.rb
Expand Up @@ -29,7 +29,7 @@ module ActionDispatch # :nodoc:
# class DemoControllerTest < ActionDispatch::IntegrationTest
# def test_print_root_path_to_console
# get('/')
# puts @response.body
# puts response.body
# end
# end
class Response
Expand Down

0 comments on commit d7532c1

Please sign in to comment.