diff --git a/tracks/app/controllers/application.rb b/tracks/app/controllers/application.rb
index a22e5818..e040795a 100644
--- a/tracks/app/controllers/application.rb
+++ b/tracks/app/controllers/application.rb
@@ -90,8 +90,8 @@ class ApplicationController < ActionController::Base
def init_not_done_counts(parents = ['project','context'])
parents.each {|parent|
- eval("@#{parent}_not_done_counts = Todo.count(:todo,
- :conditions => ['todos.user_id = ? and todos.type = ? and todos.done = ?', @user.id, \"Immediate\", false],
+ eval("@#{parent}_not_done_counts = Todo.count(:all,
+ :conditions => ['user_id = ? and type = ? and done = ?', @user.id, \"Immediate\", false],
:group => :#{parent}_id)")
}
end
diff --git a/tracks/script/process/spinner b/tracks/script/process/spinner
deleted file mode 100755
index 6816b32e..00000000
--- a/tracks/script/process/spinner
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/usr/bin/env ruby
-require File.dirname(__FILE__) + '/../../config/boot'
-require 'commands/process/spinner'
diff --git a/tracks/vendor/rails/actionmailer/CHANGELOG b/tracks/vendor/rails/actionmailer/CHANGELOG
index 2ceba66d..d7c11e79 100644
--- a/tracks/vendor/rails/actionmailer/CHANGELOG
+++ b/tracks/vendor/rails/actionmailer/CHANGELOG
@@ -1,3 +1,22 @@
+*1.2.4* (August 8th, 2006)
+
+* Backport of documentation enhancements. [Kevin Clark, Marcel Molina Jr]
+
+* Correct spurious documentation example code which results in a SyntaxError. [Marcel Molina Jr.]
+
+* Mailer template root applies to a class and its subclasses rather than acting globally. #5555 [somekool@gmail.com]
+
+
+*1.2.3* (June 29th, 2006)
+
+* Depend on Action Pack 1.12.3
+
+
+*1.2.2* (June 27th, 2006)
+
+* Depend on Action Pack 1.12.2
+
+
*1.2.1* (April 6th, 2005)
* Be part of Rails 1.1.1
diff --git a/tracks/vendor/rails/actionmailer/lib/action_mailer/base.rb b/tracks/vendor/rails/actionmailer/lib/action_mailer/base.rb
index 96a6db64..a67072a9 100644
--- a/tracks/vendor/rails/actionmailer/lib/action_mailer/base.rb
+++ b/tracks/vendor/rails/actionmailer/lib/action_mailer/base.rb
@@ -5,20 +5,92 @@ require 'action_mailer/utils'
require 'tmail/net'
module ActionMailer #:nodoc:
- # Usage:
+ # ActionMailer allows you to send email from your application using a mailer model and views.
#
- # class ApplicationMailer < ActionMailer::Base
- # # Set up properties
- # # Properties can also be specified via accessor methods
- # # (i.e. self.subject = "foo") and instance variables (@subject = "foo").
+ # = Mailer Models
+ # To use ActionMailer, you need to create a mailer model.
+ #
+ # $ script/generate mailer Notifier
+ #
+ # The generated model inherits from ActionMailer::Base. Emails are defined by creating methods within the model which are then
+ # used to set variables to be used in the mail template, to change options on the mail, or
+ # to add attachments.
+ #
+ # Examples:
+ #
+ # class Notifier < ActionMailer::Base
+ # def signup_notification(recipient)
+ # recipients recipient.email_address_with_name
+ # from "system@example.com"
+ # subject "New account information"
+ # body "account" => recipient
+ # end
+ # end
+ #
+ # Mailer methods have the following configuration methods available.
+ #
+ # * recipients - Takes one or more email addresses. These addresses are where your email will be delivered to. Sets the To: header.
+ # * subject - The subject of your email. Sets the Subject: header.
+ # * from - Who the email you are sending is from. Sets the From: header.
+ # * cc - Takes one or more email addresses. These addresses will receive a carbon copy of your email. Sets the Cc: header.
+ # * bcc - Takes one or more email address. These addresses will receive a blind carbon copy of your email. Sets the Bcc header.
+ # * sent_on - The date on which the message was sent. If not set, the header wil be set by the delivery agent.
+ # * content_type - Specify the content type of the message. Defaults to text/plain.
+ # * headers - Specify additional headers to be set for the message, e.g. headers 'X-Mail-Count' => 107370.
+ #
+ # The body method has special behavior. It takes a hash which generates an instance variable
+ # named after each key in the hash containing the value that that key points to.
+ #
+ # So, for example, body "account" => recipient would result
+ # in an instance variable @account with the value of recipient being accessible in the
+ # view.
+ #
+ # = Mailer Views
+ # Like ActionController, each mailer class has a corresponding view directory
+ # in which each method of the class looks for a template with its name.
+ # To define a template to be used with a mailing, create an .rhtml file with the same name as the method
+ # in your mailer model. For example, in the mailer defined above, the template at
+ # app/views/notifier/signup_notification.rhtml would be used to generate the email.
+ #
+ # Variables defined in the model are accessible as instance variables in the view.
+ #
+ # Emails by default are sent in plain text, so a sample view for our model example might look like this:
+ #
+ # Hi <%= @account.name %>,
+ # Thanks for joining our service! Please check back often.
+ #
+ # = Sending Mail
+ # Once a mailer action and template are defined, you can deliver your message or create it and save it
+ # for delivery later:
+ #
+ # Notifier.deliver_signup_notification(david) # sends the email
+ # mail = Notifier.create_signup_notification(david) # => a tmail object
+ # Notifier.deliver(mail)
+ #
+ # You never instantiate your mailer class. Rather, your delivery instance
+ # methods are automatically wrapped in class methods that start with the word
+ # deliver_ followed by the name of the mailer method that you would
+ # like to deliver. The signup_notification method defined above is
+ # delivered by invoking Notifier.deliver_signup_notification.
+ #
+ # = HTML Email
+ # To send mail as HTML, make sure your view (the .rhtml file) generates HTML and
+ # set the content type to html.
+ #
+ # class MyMailer < ActionMailer::Base
# def signup_notification(recipient)
# recipients recipient.email_address_with_name
# subject "New account information"
- # body { "account" => recipient }
+ # body "account" => recipient
# from "system@example.com"
+ # content_type "text/html" # Here's where the magic happens
# end
+ # end
#
- # # explicitly specify multipart messages
+ # = Multipart Email
+ # You can explicitly specify multipart messages:
+ #
+ # class ApplicationMailer < ActionMailer::Base
# def signup_notification(recipient)
# recipients recipient.email_address_with_name
# subject "New account information"
@@ -32,7 +104,28 @@ module ActionMailer #:nodoc:
# p.transfer_encoding = "base64"
# end
# end
+ # end
+ #
+ # Multipart messages can also be used implicitly because ActionMailer will automatically
+ # detect and use multipart templates, where each template is named after the name of the action, followed
+ # by the content type. Each such detected template will be added as separate part to the message.
+ #
+ # For example, if the following templates existed:
+ # * signup_notification.text.plain.rhtml
+ # * signup_notification.text.html.rhtml
+ # * signup_notification.text.xml.rxml
+ # * signup_notification.text.x-yaml.rhtml
+ #
+ # Each would be rendered and added as a separate part to the message,
+ # with the corresponding content type. The same body hash is passed to
+ # each template.
#
+ # = Attachments
+ # Attachments can be added by using the +attachment+ method.
+ #
+ # Example:
+ #
+ # class ApplicationMailer < ActionMailer::Base
# # attachments
# def signup_notification(recipient)
# recipients recipient.email_address_with_name
@@ -46,36 +139,7 @@ module ActionMailer #:nodoc:
# a.body = generate_your_pdf_here()
# end
# end
- #
- # # implicitly multipart messages
- # def signup_notification(recipient)
- # recipients recipient.email_address_with_name
- # subject "New account information"
- # from "system@example.com"
- # body(:account => "recipient")
- #
- # # ActionMailer will automatically detect and use multipart templates,
- # # where each template is named after the name of the action, followed
- # # by the content type. Each such detected template will be added as
- # # a separate part to the message.
- # #
- # # for example, if the following templates existed:
- # # * signup_notification.text.plain.rhtml
- # # * signup_notification.text.html.rhtml
- # # * signup_notification.text.xml.rxml
- # # * signup_notification.text.x-yaml.rhtml
- # #
- # # Each would be rendered and added as a separate part to the message,
- # # with the corresponding content type. The same body hash is passed to
- # # each template.
- # end
- # end
- #
- # # After this, post_notification will look for "templates/application_mailer/post_notification.rhtml"
- # ApplicationMailer.template_root = "templates"
- #
- # ApplicationMailer.create_comment_notification(david, hello_world) # => a tmail object
- # ApplicationMailer.deliver_comment_notification(david, hello_world) # sends the email
+ # end
#
# = Configuration options
#
@@ -127,7 +191,7 @@ module ActionMailer #:nodoc:
private_class_method :new #:nodoc:
- cattr_accessor :template_root
+ class_inheritable_accessor :template_root
cattr_accessor :logger
@@server_settings = {
diff --git a/tracks/vendor/rails/actionmailer/lib/action_mailer/version.rb b/tracks/vendor/rails/actionmailer/lib/action_mailer/version.rb
index ba6a301c..8ecf6509 100644
--- a/tracks/vendor/rails/actionmailer/lib/action_mailer/version.rb
+++ b/tracks/vendor/rails/actionmailer/lib/action_mailer/version.rb
@@ -2,7 +2,7 @@ module ActionMailer
module VERSION #:nodoc:
MAJOR = 1
MINOR = 2
- TINY = 1
+ TINY = 4
STRING = [MAJOR, MINOR, TINY].join('.')
end
diff --git a/tracks/vendor/rails/actionmailer/rakefile b/tracks/vendor/rails/actionmailer/rakefile
index 3cf143b1..df1dd144 100644
--- a/tracks/vendor/rails/actionmailer/rakefile
+++ b/tracks/vendor/rails/actionmailer/rakefile
@@ -54,14 +54,14 @@ spec = Gem::Specification.new do |s|
s.rubyforge_project = "actionmailer"
s.homepage = "http://www.rubyonrails.org"
- s.add_dependency('actionpack', '= 1.12.1' + PKG_BUILD)
+ s.add_dependency('actionpack', '= 1.12.4' + PKG_BUILD)
s.has_rdoc = true
s.requirements << 'none'
s.require_path = 'lib'
s.autorequire = 'action_mailer'
- s.files = [ "rakefile", "install.rb", "README", "CHANGELOG", "MIT-LICENSE" ]
+ s.files = [ "Rakefile", "install.rb", "README", "CHANGELOG", "MIT-LICENSE" ]
s.files = s.files + Dir.glob( "lib/**/*" ).delete_if { |item| item.include?( "\.svn" ) }
s.files = s.files + Dir.glob( "test/**/*" ).delete_if { |item| item.include?( "\.svn" ) }
end
@@ -84,116 +84,12 @@ task :pdoc => [:rdoc] do
end
desc "Publish the release files to RubyForge."
-task :release => [:package] do
- files = ["gem", "tgz", "zip"].map { |ext| "pkg/#{PKG_FILE_NAME}.#{ext}" }
+task :release => [ :package ] do
+ `rubyforge login`
- if RUBY_FORGE_PROJECT then
- require 'net/http'
- require 'open-uri'
-
- project_uri = "http://rubyforge.org/projects/#{RUBY_FORGE_PROJECT}/"
- project_data = open(project_uri) { |data| data.read }
- group_id = project_data[/[?&]group_id=(\d+)/, 1]
- raise "Couldn't get group id" unless group_id
-
- # This echos password to shell which is a bit sucky
- if ENV["RUBY_FORGE_PASSWORD"]
- password = ENV["RUBY_FORGE_PASSWORD"]
- else
- print "#{RUBY_FORGE_USER}@rubyforge.org's password: "
- password = STDIN.gets.chomp
- end
-
- login_response = Net::HTTP.start("rubyforge.org", 80) do |http|
- data = [
- "login=1",
- "form_loginname=#{RUBY_FORGE_USER}",
- "form_pw=#{password}"
- ].join("&")
- http.post("/account/login.php", data)
- end
-
- cookie = login_response["set-cookie"]
- raise "Login failed" unless cookie
- headers = { "Cookie" => cookie }
-
- release_uri = "http://rubyforge.org/frs/admin/?group_id=#{group_id}"
- release_data = open(release_uri, headers) { |data| data.read }
- package_id = release_data[/[?&]package_id=(\d+)/, 1]
- raise "Couldn't get package id" unless package_id
-
- first_file = true
- release_id = ""
-
- files.each do |filename|
- basename = File.basename(filename)
- file_ext = File.extname(filename)
- file_data = File.open(filename, "rb") { |file| file.read }
-
- puts "Releasing #{basename}..."
-
- release_response = Net::HTTP.start("rubyforge.org", 80) do |http|
- release_date = Time.now.strftime("%Y-%m-%d %H:%M")
- type_map = {
- ".zip" => "3000",
- ".tgz" => "3110",
- ".gz" => "3110",
- ".gem" => "1400"
- }; type_map.default = "9999"
- type = type_map[file_ext]
- boundary = "rubyqMY6QN9bp6e4kS21H4y0zxcvoor"
-
- query_hash = if first_file then
- {
- "group_id" => group_id,
- "package_id" => package_id,
- "release_name" => RELEASE_NAME,
- "release_date" => release_date,
- "type_id" => type,
- "processor_id" => "8000", # Any
- "release_notes" => "",
- "release_changes" => "",
- "preformatted" => "1",
- "submit" => "1"
- }
- else
- {
- "group_id" => group_id,
- "release_id" => release_id,
- "package_id" => package_id,
- "step2" => "1",
- "type_id" => type,
- "processor_id" => "8000", # Any
- "submit" => "Add This File"
- }
- end
-
- query = "?" + query_hash.map do |(name, value)|
- [name, URI.encode(value)].join("=")
- end.join("&")
-
- data = [
- "--" + boundary,
- "Content-Disposition: form-data; name=\"userfile\"; filename=\"#{basename}\"",
- "Content-Type: application/octet-stream",
- "Content-Transfer-Encoding: binary",
- "", file_data, ""
- ].join("\x0D\x0A")
-
- release_headers = headers.merge(
- "Content-Type" => "multipart/form-data; boundary=#{boundary}"
- )
-
- target = first_file ? "/frs/admin/qrs.php" : "/frs/admin/editrelease.php"
- http.post(target + query, data, release_headers)
- end
-
- if first_file then
- release_id = release_response.body[/release_id=(\d+)/, 1]
- raise("Couldn't get release id") unless release_id
- end
-
- first_file = false
- end
+ for ext in %w( gem tgz zip )
+ release_command = "rubyforge add_release #{PKG_NAME} #{PKG_NAME} 'REL #{PKG_VERSION}' pkg/#{PKG_NAME}-#{PKG_VERSION}.#{ext}"
+ puts release_command
+ system(release_command)
end
-end
+end
\ No newline at end of file
diff --git a/tracks/vendor/rails/actionmailer/test/mail_service_test.rb b/tracks/vendor/rails/actionmailer/test/mail_service_test.rb
index c810cf10..5fdf4074 100644
--- a/tracks/vendor/rails/actionmailer/test/mail_service_test.rb
+++ b/tracks/vendor/rails/actionmailer/test/mail_service_test.rb
@@ -24,6 +24,8 @@ class Net::SMTP
end
class FunkyPathMailer < ActionMailer::Base
+ self.template_root = "#{File.dirname(__FILE__)}/fixtures/path.with.dots"
+
def multipart_with_template_path_with_dots(recipient)
recipients recipient
subject "Have a lovely picture"
@@ -816,3 +818,15 @@ EOF
end
end
+class InheritableTemplateRootTest < Test::Unit::TestCase
+ def test_attr
+ expected = "#{File.dirname(__FILE__)}/fixtures/path.with.dots"
+ assert_equal expected, FunkyPathMailer.template_root
+
+ sub = Class.new(FunkyPathMailer)
+ sub.template_root = 'test/path'
+
+ assert_equal 'test/path', sub.template_root
+ assert_equal expected, FunkyPathMailer.template_root
+ end
+end
diff --git a/tracks/vendor/rails/actionpack/CHANGELOG b/tracks/vendor/rails/actionpack/CHANGELOG
index e332c9b1..61eedcd9 100644
--- a/tracks/vendor/rails/actionpack/CHANGELOG
+++ b/tracks/vendor/rails/actionpack/CHANGELOG
@@ -1,4 +1,55 @@
-*1.12.1* (April 6th, 2005)
+*1.12.4* (August 8th, 2006)
+
+* Documentation fix: integration test scripts don't require integration_test. #4914 [Frederick Ros ]
+
+* ActionController::Base Summary documentation rewrite. #4900 [kevin.clark@gmail.com]
+
+* Fix text_helper.rb documentation rendering. #4725 [Frederick Ros]
+
+* Fixes bad rendering of JavaScriptMacrosHelper rdoc. #4910 [Frederick Ros]
+
+* Enhance documentation for setting headers in integration tests. Skip auto HTTP prepending when its already there. #4079 [Rick Olson]
+
+* Documentation for AbstractRequest. #4895 [kevin.clark@gmail.com]
+
+* Remove all remaining references to @params in the documentation. [Marcel Molina Jr.]
+
+* Add documentation for redirect_to :back's RedirectBackError exception. [Marcel Molina Jr.]
+
+* Update layout and content_for documentation to use yield rather than magic @content_for instance variables. [Marcel Molina Jr.]
+
+* Cache CgiRequest#request_parameters so that multiple calls don't re-parse multipart data. [Rick]
+
+* Fixed that remote_form_for can leave out the object parameter and default to the instance variable of the object_name, just like form_for [DHH]
+
+* Added ActionController.filter_parameter_logging that makes it easy to remove passwords, credit card numbers, and other sensitive information from being logged when a request is handled. #1897 [jeremye@bsa.ca.gov]
+
+* Fixed that real files and symlinks should be treated the same when compiling templates. #5438 [zachary@panandscan.com]
+
+* Add :status option to send_data and send_file. Defaults to '200 OK'. #5243 [Manfred Stienstra ]
+
+* Update documentation for erb trim syntax. #5651 [matt@mattmargolis.net]
+
+* Short documentation to mention use of Mime::Type.register. #5710 [choonkeat@gmail.com]
+
+
+*1.12.3* (June 28th, 2006)
+
+* Fix broken traverse_to_controller. We now:
+ Look for a _controller.rb file under RAILS_ROOT to load.
+ If we find it, we require_dependency it and return the controller it defined. (If none was defined we stop looking.)
+ If we don't find it, we look for a .rb file under RAILS_ROOT to load. If we find it, and it loads a constant we keep looking.
+ Otherwise we check to see if a directory of the same name exists, and if it does we create a module for it.
+
+
+*1.12.2* (June 27th, 2006)
+
+* Refinement to avoid exceptions in traverse_to_controller.
+
+* (Hackish) Fix loading of arbitrary files in Ruby's load path by traverse_to_controller. [Nicholas Seckar]
+
+
+*1.12.1* (April 6th, 2006)
* Fixed that template extensions would be cached development mode #4624 [Stefan Kaes]
@@ -30,7 +81,7 @@
This can be used by deployment managers to set the asset id by application revision
-*1.12.0* (March 27th, 2005)
+*1.12.0* (March 27th, 2006)
* Add documentation for respond_to. [Jamis Buck]
diff --git a/tracks/vendor/rails/actionpack/README b/tracks/vendor/rails/actionpack/README
index dc475a66..13ea9d1e 100644
--- a/tracks/vendor/rails/actionpack/README
+++ b/tracks/vendor/rails/actionpack/README
@@ -469,3 +469,7 @@ And as Jim from Rake says:
For other information, feel free to ask on the ruby-talk mailing list (which
is mirrored to comp.lang.ruby) or contact mailto:david@loudthinking.com.
+
+
+
+...
diff --git a/tracks/vendor/rails/actionpack/filler b/tracks/vendor/rails/actionpack/filler
new file mode 100644
index 00000000..1750e50e
--- /dev/null
+++ b/tracks/vendor/rails/actionpack/filler
@@ -0,0 +1,53 @@
+this is just a filler file to try and work around the zlib error when unpacking the gem. Please ignore it, thanks.
+
+abcDEfgHijkLMNopqrStUVWxyz
+AbcdefgHIjklMnOpqrsTUvwxYZ
+AbCDEfghIjKLmnoPQrstuVwxyz
+abcDefGhijKlmnopQrstuvWXYz
+AbCdefGhiJKlmnoPqrstuVwxYz
+aBcdefGHijKlmnOpQrStUvwxYz
+AbcdEfGhIJklmnOPQrSTuvwxyZ
+AbcDeFGHijkLmnopqrstuVwxYZ
+ABcdefgHIjkLmnOpqrStuVwxyZ
+aBcdEFGhiJklmnopQrstuVwxyz
+abcDefgHijKlmnoPQrSTuvwxYz
+AbcdefGhiJklmnOpqrstuVwxYZ
+abcdefgHIjKlMNoPqRsTuvwxYz
+ABcDeFghIjklMnopQrstUVwxyZ
+AbcdefGhijkLmNopQRstuVWxYZ
+aBcdefGhijklMNOpqRsTUvwxyz
+abcdEFGhiJKlmnOPQrStUVwxyz
+abcDefghIJklmnOPqRStuVWxyz
+abcdefGhIjklmnoPQrStUVwXyZ
+abcDefghIjkLmnopQrstuVwxyz
+AbcdefGhIjklMNOPqrstuvWXyz
+AbCdEfGHijkLmnopqrstuvwxyz
+abCdEFghijKlmnopqRstuvwXYz
+abCdEfghIJklmnOPqrsTUvwxyz
+AbcdeFghijklmnoPqrStUvWxyZ
+aBcDEFghIJKlmnopqrstuvWXyz
+abcdEfghiJKlmNopqrstuvwXyz
+AbcdEFGHIJKlmnopqRsTuvwxYz
+abcdeFgHiJklmnoPQRsTuvwXYz
+abcdEfGhijkLmnOPqrstUvwXYZ
+abCDeFGhijklmNopQrstUvwxYz
+abCdeFGhIjklmnOpQrstUvwxyZ
+aBcDEFgHijKlmNOPQrsTUvwxYz
+aBcDefghijklmNoPqrstUvWXyz
+AbcDefgHiJklmnOPqRStuvwxYz
+aBcdefGHijklMnopqRstUvwxyz
+AbCdefghijKLmnopqRstuvWXyz
+aBCdefGhiJkLMnopQrsTUvwxyz
+ABcdefGHijKlmnOPqrSTUvWXyz
+aBCdEfGHIJklMnopqRsTUvWxyz
+ABcDEFGHIJklMnopqrSTuVwxyz
+abcdEfghijklMnopqrstuvwxyz
+AbCDEFghIjkLmNOpQRstUVwxyZ
+abCdEFghIJklMNOPqrstUvwXYZ
+abCdefghijklmnoPQrstuVwxyz
+AbcdEfghijkLMnopqRSTUvWxYz
+ABcDEfGhIjKLmNopqrStuVwxyZ
+abCdefgHijklmnOpQRStuvwxYz
+abCdeFghijKLmNopQrstuvwxyZ
+abcdEFGHijKlmnopqrstuvwxYZ
+
diff --git a/tracks/vendor/rails/actionpack/lib/action_controller/base.rb b/tracks/vendor/rails/actionpack/lib/action_controller/base.rb
index 751f364a..37b98be9 100644
--- a/tracks/vendor/rails/actionpack/lib/action_controller/base.rb
+++ b/tracks/vendor/rails/actionpack/lib/action_controller/base.rb
@@ -49,13 +49,15 @@ module ActionController #:nodoc:
end
end
- # Action Controllers are made up of one or more actions that performs its purpose and then either renders a template or
- # redirects to another action. An action is defined as a public method on the controller, which will automatically be
- # made accessible to the web-server through a mod_rewrite mapping. A sample controller could look like this:
+ # Action Controllers are the core of a web request in Rails. They are made up of one or more actions that are executed
+ # on request and then either render a template or redirect to another action. An action is defined as a public method
+ # on the controller, which will automatically be made accessible to the web-server through Rails Routes.
+ #
+ # A sample controller could look like this:
#
# class GuestBookController < ActionController::Base
# def index
- # @entries = Entry.find_all
+ # @entries = Entry.find(:all)
# end
#
# def sign
@@ -64,26 +66,17 @@ module ActionController #:nodoc:
# end
# end
#
- # GuestBookController.template_root = "templates/"
- # GuestBookController.process_cgi
+ # Actions, by default, render a template in the app/views directory corresponding to the name of the controller and action
+ # after executing code in the action. For example, the +index+ action of the +GuestBookController+ would render the
+ # template app/views/guestbook/index.rhtml by default after populating the @entries instance variable.
#
- # All actions assume that you want to render a template matching the name of the action at the end of the performance
- # unless you tell it otherwise. The index action complies with this assumption, so after populating the @entries instance
- # variable, the GuestBookController will render "templates/guestbook/index.rhtml".
- #
- # Unlike index, the sign action isn't interested in rendering a template. So after performing its main purpose (creating a
- # new entry in the guest book), it sheds the rendering assumption and initiates a redirect instead. This redirect works by
- # returning an external "302 Moved" HTTP response that takes the user to the index action.
+ # Unlike index, the sign action will not render a template. After performing its main purpose (creating a
+ # new entry in the guest book), it initiates a redirect instead. This redirect works by returning an external
+ # "302 Moved" HTTP response that takes the user to the index action.
#
# The index and sign represent the two basic action archetypes used in Action Controllers. Get-and-show and do-and-redirect.
# Most actions are variations of these themes.
#
- # Also note that it's the final call to process_cgi that actually initiates the action performance. It will extract
- # request and response objects from the CGI
- #
- # When Action Pack is used inside of Rails, the template_root is automatically configured and you don't need to call process_cgi
- # yourself.
- #
# == Requests
#
# Requests are processed by the Action Controller framework by extracting the value of the "action" key in the request parameters.
@@ -94,16 +87,16 @@ module ActionController #:nodoc:
# The full request object is available with the request accessor and is primarily used to query for http headers. These queries
# are made by accessing the environment hash, like this:
#
- # def hello_ip
- # location = request.env["REMOTE_IP"]
- # render :text => "Hello stranger from #{location}"
+ # def server_ip
+ # location = request.env["SERVER_ADDR"]
+ # render :text => "This server hosted at #{location}"
# end
#
# == Parameters
#
- # All request parameters, whether they come from a GET or POST request, or from the URL, are available through the params hash.
- # So an action that was performed through /weblog/list?category=All&limit=5 will include { "category" => "All", "limit" => 5 }
- # in params.
+ # All request parameters, whether they come from a GET or POST request, or from the URL, are available through the params method
+ # which returns a hash. For example, an action that was performed through /weblog/list?category=All&limit=5 will include
+ # { "category" => "All", "limit" => 5 } in params.
#
# It's also possible to construct multi-dimensional parameter hashes by specifying keys using brackets, such as:
#
@@ -116,12 +109,12 @@ module ActionController #:nodoc:
#
# == Sessions
#
- # Sessions allows you to store objects in memory between requests. This is useful for objects that are not yet ready to be persisted,
+ # Sessions allows you to store objects in between requests. This is useful for objects that are not yet ready to be persisted,
# such as a Signup object constructed in a multi-paged process, or objects that don't change much and are needed all the time, such
# as a User object for a system that requires login. The session should not be used, however, as a cache for objects where it's likely
# they could be changed unknowingly. It's usually too much work to keep it all synchronized -- something databases already excel at.
#
- # You can place objects in the session by using the session hash accessor:
+ # You can place objects in the session by using the session method, which accesses a hash:
#
# session[:person] = Person.authenticate(user_name, password)
#
@@ -129,17 +122,24 @@ module ActionController #:nodoc:
#
# Hello #{session[:person]}
#
- # Any object can be placed in the session (as long as it can be Marshalled). But remember that 1000 active sessions each storing a
- # 50kb object could lead to a 50MB memory overhead. In other words, think carefully about size and caching before resorting to the use
- # of the session.
- #
# For removing objects from the session, you can either assign a single key to nil, like session[:person] = nil, or you can
# remove the entire session with reset_session.
#
+ # By default, sessions are stored on the file system in RAILS_ROOT/tmp/sessions. Any object can be placed in the session
+ # (as long as it can be Marshalled). But remember that 1000 active sessions each storing a 50kb object could lead to a 50MB store on the filesystem.
+ # In other words, think carefully about size and caching before resorting to the use of the session on the filesystem.
+ #
+ # An alternative to storing sessions on disk is to use ActiveRecordStore to store sessions in your database, which can solve problems
+ # caused by storing sessions in the file system and may speed up your application. To use ActiveRecordStore, uncomment the line:
+ #
+ # config.action_controller.session_store = :active_record_store
+ #
+ # in your environment.rb and run rake db:sessions:create.
+ #
# == Responses
#
# Each action results in a response, which holds the headers and document to be sent to the user's browser. The actual response
- # object is generated automatically through the use of renders and redirects, so it's normally nothing you'll need to be concerned about.
+ # object is generated automatically through the use of renders and redirects and requires no user intervention.
#
# == Renders
#
@@ -161,9 +161,9 @@ module ActionController #:nodoc:
# def search
# @results = Search.find(params[:query])
# case @results
- # when 0 then render :action=> "no_results"
- # when 1 then render :action=> "show"
- # when 2..10 then render :action=> "show_many"
+ # when 0 then render :action => "no_results"
+ # when 1 then render :action => "show"
+ # when 2..10 then render :action => "show_many"
# end
# end
#
@@ -171,32 +171,21 @@ module ActionController #:nodoc:
#
# == Redirects
#
- # Redirecting is what actions that update the model do when they're done. The save_post method shouldn't be responsible for also
- # showing the post once it's saved -- that's the job for show_post. So once save_post has completed its business, it'll
- # redirect to show_post. All redirects are external, which means that when the user refreshes his browser, it's not going to save
- # the post again, but rather just show it one more time.
- #
- # This sounds fairly simple, but the redirection is complicated by the quest for a phenomenon known as "pretty urls". Instead of accepting
- # the dreadful being that is "weblog_controller?action=show&post_id=5", Action Controller goes out of its way to represent the former as
- # "/weblog/show/5". And this is even the simple case. As an example of a more advanced pretty url consider
- # "/library/books/ISBN/0743536703/show", which can be mapped to books_controller?action=show&type=ISBN&id=0743536703.
- #
- # Redirects work by rewriting the URL of the current action. So if the show action was called by "/library/books/ISBN/0743536703/show",
- # we can redirect to an edit action simply by doing redirect_to(:action => "edit"), which could throw the user to
- # "/library/books/ISBN/0743536703/edit". Naturally, you'll need to setup the routes configuration file to point to the proper controller
- # and action in the first place, but once you have, it can be rewritten with ease.
- #
- # Let's consider a bunch of examples on how to go from "/clients/37signals/basecamp/project/dash" to somewhere else:
+ # Redirects are used to move from one action to another. For example, after a create action, which stores a blog entry to a database,
+ # we might like to show the user the new entry. Because we're following good DRY principles (Don't Repeat Yourself), we're going to reuse (and redirect to)
+ # a show action that we'll assume has already been created. The code might look like this:
#
- # redirect_to(:action => "edit") =>
- # /clients/37signals/basecamp/project/dash
- #
- # redirect_to(:client_name => "nextangle", :project_name => "rails") =>
- # /clients/nextangle/rails/project/dash
+ # def create
+ # @entry = Entry.new(params[:entry])
+ # if @entry.save
+ # # The entry was saved correctly, redirect to show
+ # redirect_to :action => 'show', :id => @entry.id
+ # else
+ # # things didn't go so well, do something else
+ # end
+ # end
#
- # Those redirects happen under the configuration of:
- #
- # map.connect 'clients/:client_name/:project_name/:controller/:action'
+ # In this case, after saving our new entry to the database, the user is redirected to the show method which is then executed.
#
# == Calling multiple redirects or renders
#
@@ -214,15 +203,6 @@ module ActionController #:nodoc:
# render :action => "overthere" # won't be called unless monkeys is nil
# end
#
- # == Environments
- #
- # Action Controller works out of the box with CGI, FastCGI, and mod_ruby. CGI and mod_ruby controllers are triggered just the same using:
- #
- # WeblogController.process_cgi
- #
- # FastCGI controllers are triggered using:
- #
- # FCGI.each_cgi{ |cgi| WeblogController.process_cgi(cgi) }
class Base
DEFAULT_RENDER_STATUS_CODE = "200 OK"
@@ -263,10 +243,10 @@ module ActionController #:nodoc:
# Modern REST web services often need to submit complex data to the web application.
# The param_parsers hash lets you register handlers wich will process the http body and add parameters to the
- # @params hash. These handlers are invoked for post and put requests.
+ # params hash. These handlers are invoked for post and put requests.
#
# By default application/xml is enabled. A XmlSimple class with the same param name as the root will be instanciated
- # in the @params. This allows XML requests to mask themselves as regular form submissions, so you can have one
+ # in the params. This allows XML requests to mask themselves as regular form submissions, so you can have one
# action serve both regular forms and web service requests.
#
# Example of doing your own parser for a custom content type:
@@ -366,6 +346,53 @@ module ActionController #:nodoc:
def hide_action(*names)
write_inheritable_attribute(:hidden_actions, hidden_actions | names.collect { |n| n.to_s })
end
+
+ # Replace sensitive paramater data from the request log.
+ # Filters paramaters that have any of the arguments as a substring.
+ # Looks in all subhashes of the param hash for keys to filter.
+ # If a block is given, each key and value of the paramater hash and all
+ # subhashes is passed to it, the value or key
+ # can be replaced using String#replace or similar method.
+ #
+ # Examples:
+ # filter_parameter_logging
+ # => Does nothing, just slows the logging process down
+ #
+ # filter_parameter_logging :password
+ # => replaces the value to all keys matching /password/i with "[FILTERED]"
+ #
+ # filter_parameter_logging :foo, "bar"
+ # => replaces the value to all keys matching /foo|bar/i with "[FILTERED]"
+ #
+ # filter_parameter_logging { |k,v| v.reverse! if k =~ /secret/i }
+ # => reverses the value to all keys matching /secret/i
+ #
+ # filter_parameter_logging(:foo, "bar") { |k,v| v.reverse! if k =~ /secret/i }
+ # => reverses the value to all keys matching /secret/i, and
+ # replaces the value to all keys matching /foo|bar/i with "[FILTERED]"
+ def filter_parameter_logging(*filter_words, &block)
+ parameter_filter = Regexp.new(filter_words.collect{ |s| s.to_s }.join('|'), true) if filter_words.length > 0
+
+ define_method(:filter_parameters) do |unfiltered_parameters|
+ filtered_parameters = {}
+
+ unfiltered_parameters.each do |key, value|
+ if key =~ parameter_filter
+ filtered_parameters[key] = '[FILTERED]'
+ elsif value.is_a?(Hash)
+ filtered_parameters[key] = filter_parameters(value)
+ elsif block_given?
+ key, value = key.dup, value.dup
+ yield key, value
+ filtered_parameters[key] = value
+ else
+ filtered_parameters[key] = value
+ end
+ end
+
+ filtered_parameters
+ end
+ end
end
public
@@ -803,6 +830,10 @@ module ActionController #:nodoc:
# redirect_to :back
#
# The redirection happens as a "302 Moved" header.
+ #
+ # When using redirect_to :back, if there is no referrer,
+ # RedirectBackError will be raised. You may specify some fallback
+ # behavior for this case by rescueing RedirectBackError.
def redirect_to(options = {}, *parameters_for_method_reference) #:doc:
case options
when %r{^\w+://.*}
@@ -901,7 +932,7 @@ module ActionController #:nodoc:
if logger
logger.info "\n\nProcessing #{controller_class_name}\##{action_name} (for #{request_origin}) [#{request.method.to_s.upcase}]"
logger.info " Session ID: #{@session.session_id}" if @session and @session.respond_to?(:session_id)
- logger.info " Parameters: #{@params.inspect}"
+ logger.info " Parameters: #{respond_to?(:filter_parameters) ? filter_parameters(@params).inspect : @params.inspect}"
end
end
diff --git a/tracks/vendor/rails/actionpack/lib/action_controller/caching.rb b/tracks/vendor/rails/actionpack/lib/action_controller/caching.rb
index 0cb70c86..91da89ad 100644
--- a/tracks/vendor/rails/actionpack/lib/action_controller/caching.rb
+++ b/tracks/vendor/rails/actionpack/lib/action_controller/caching.rb
@@ -38,9 +38,9 @@ module ActionController #:nodoc:
#
# class WeblogController < ActionController::Base
# def update
- # List.update(@params["list"]["id"], @params["list"])
- # expire_page :action => "show", :id => @params["list"]["id"]
- # redirect_to :action => "show", :id => @params["list"]["id"]
+ # List.update(params[:list][:id], params[:list])
+ # expire_page :action => "show", :id => params[:list][:id]
+ # redirect_to :action => "show", :id => params[:list][:id]
# end
# end
#
diff --git a/tracks/vendor/rails/actionpack/lib/action_controller/cgi_process.rb b/tracks/vendor/rails/actionpack/lib/action_controller/cgi_process.rb
index ce8acdf3..09a6000b 100644
--- a/tracks/vendor/rails/actionpack/lib/action_controller/cgi_process.rb
+++ b/tracks/vendor/rails/actionpack/lib/action_controller/cgi_process.rb
@@ -64,11 +64,12 @@ module ActionController #:nodoc:
end
def request_parameters
- if ActionController::Base.param_parsers.has_key?(content_type)
- CGIMethods.parse_formatted_request_parameters(content_type, @env['RAW_POST_DATA'])
- else
- CGIMethods.parse_request_parameters(@cgi.params)
- end
+ @request_parameters ||=
+ if ActionController::Base.param_parsers.has_key?(content_type)
+ CGIMethods.parse_formatted_request_parameters(content_type, @env['RAW_POST_DATA'])
+ else
+ CGIMethods.parse_request_parameters(@cgi.params)
+ end
end
def cookies
diff --git a/tracks/vendor/rails/actionpack/lib/action_controller/integration.rb b/tracks/vendor/rails/actionpack/lib/action_controller/integration.rb
index 33ec1a01..74817c4b 100644
--- a/tracks/vendor/rails/actionpack/lib/action_controller/integration.rb
+++ b/tracks/vendor/rails/actionpack/lib/action_controller/integration.rb
@@ -140,14 +140,18 @@ module ActionController
# Performs a GET request with the given parameters. The parameters may
# be +nil+, a Hash, or a string that is appropriately encoded
- # (application/x-www-form-urlencoded or multipart/form-data).
+ # (application/x-www-form-urlencoded or multipart/form-data). The headers
+ # should be a hash. The keys will automatically be upcased, with the
+ # prefix 'HTTP_' added if needed.
def get(path, parameters=nil, headers=nil)
process :get, path, parameters, headers
end
# Performs a POST request with the given parameters. The parameters may
# be +nil+, a Hash, or a string that is appropriately encoded
- # (application/x-www-form-urlencoded or multipart/form-data).
+ # (application/x-www-form-urlencoded or multipart/form-data). The headers
+ # should be a hash. The keys will automatically be upcased, with the
+ # prefix 'HTTP_' added if needed.
def post(path, parameters=nil, headers=nil)
process :post, path, parameters, headers
end
@@ -155,7 +159,9 @@ module ActionController
# Performs an XMLHttpRequest request with the given parameters, mimicing
# the request environment created by the Prototype library. The parameters
# may be +nil+, a Hash, or a string that is appropriately encoded
- # (application/x-www-form-urlencoded or multipart/form-data).
+ # (application/x-www-form-urlencoded or multipart/form-data). The headers
+ # should be a hash. The keys will automatically be upcased, with the
+ # prefix 'HTTP_' added if needed.
def xml_http_request(path, parameters=nil, headers=nil)
headers = (headers || {}).merge("X-Requested-With" => "XMLHttpRequest")
post(path, parameters, headers)
@@ -218,7 +224,7 @@ module ActionController
(headers || {}).each do |key, value|
key = key.to_s.upcase.gsub(/-/, "_")
- key = "HTTP_#{key}" unless env.has_key?(key)
+ key = "HTTP_#{key}" unless env.has_key?(key) || env =~ /^X|HTTP/
env[key] = value
end
@@ -341,7 +347,6 @@ module ActionController
# using the get/post methods:
#
# require "#{File.dirname(__FILE__)}/test_helper"
- # require "integration_test"
#
# class ExampleTest < ActionController::IntegrationTest
# fixtures :people
@@ -366,7 +371,6 @@ module ActionController
# reference any named routes you happen to have defined!
#
# require "#{File.dirname(__FILE__)}/test_helper"
- # require "integration_test"
#
# class AdvancedTest < ActionController::IntegrationTest
# fixtures :people, :rooms
diff --git a/tracks/vendor/rails/actionpack/lib/action_controller/layout.rb b/tracks/vendor/rails/actionpack/lib/action_controller/layout.rb
index 7ecff733..4e9e42d4 100644
--- a/tracks/vendor/rails/actionpack/lib/action_controller/layout.rb
+++ b/tracks/vendor/rails/actionpack/lib/action_controller/layout.rb
@@ -27,7 +27,7 @@ module ActionController #:nodoc:
# that the header and footer are only mentioned in one place, like this:
#
#
- # <%= @content_for_layout %>
+ # <%= yield %>
#
#
# And then you have content pages that look like this:
@@ -47,7 +47,7 @@ module ActionController #:nodoc:
# references that won't materialize before rendering time:
#
# <%= @page_title %>
- # <%= @content_for_layout %>
+ # <%= yield %>
#
# ...and content pages that fulfill these references _at_ rendering time:
#
@@ -159,10 +159,12 @@ module ActionController #:nodoc:
#
# As you can see, you pass the template as the first parameter, the status code as the second ("200" is OK), and the layout
# as the third.
+ #
+ # NOTE: The old notation for rendering the view from a layout was to expose the magic @content_for_layout instance
+ # variable. The preferred notation now is to use yield, as documented above.
module ClassMethods
- # If a layout is specified, all actions rendered through render and render_action will have their result assigned
- # to @content_for_layout, which can then be used by the layout to insert their contents with
- # <%= @content_for_layout %>. This layout can itself depend on instance variables assigned during action
+ # If a layout is specified, all rendered actions will have their result rendered
+ # when the layoutyield's. This layout can itself depend on instance variables assigned during action
# performance and have access to them as any normal template would.
def layout(template_name, conditions = {})
add_layout_conditions(conditions)
diff --git a/tracks/vendor/rails/actionpack/lib/action_controller/mime_responds.rb b/tracks/vendor/rails/actionpack/lib/action_controller/mime_responds.rb
index ff483789..555ffda1 100644
--- a/tracks/vendor/rails/actionpack/lib/action_controller/mime_responds.rb
+++ b/tracks/vendor/rails/actionpack/lib/action_controller/mime_responds.rb
@@ -92,6 +92,12 @@ module ActionController #:nodoc:
# Note that you can define your own XML parameter parser which would allow you to describe multiple entities
# in a single request (i.e., by wrapping them all in a single root note), but if you just go with the flow
# and accept Rails' defaults, life will be much easier.
+ #
+ # If you need to use a MIME type which isn't supported by default, you can register your own handlers in
+ # environment.rb as follows.
+ #
+ # Mime::Type.register "image/jpg", :jpg
+ #
def respond_to(*types, &block)
raise ArgumentError, "respond_to takes either types or a block, never bot" unless types.any? ^ block
block ||= lambda { |responder| types.each { |type| responder.send(type) } }
@@ -160,4 +166,4 @@ module ActionController #:nodoc:
end
end
end
-end
\ No newline at end of file
+end
diff --git a/tracks/vendor/rails/actionpack/lib/action_controller/pagination.rb b/tracks/vendor/rails/actionpack/lib/action_controller/pagination.rb
index 630b244a..a1053e65 100644
--- a/tracks/vendor/rails/actionpack/lib/action_controller/pagination.rb
+++ b/tracks/vendor/rails/actionpack/lib/action_controller/pagination.rb
@@ -31,7 +31,7 @@ module ActionController
# instance variable, which is an ordered collection of model objects for the
# current page (at most 20, sorted by last name and first name), and a
# @person_pages Paginator instance. The current page is determined
- # by the @params['page'] variable.
+ # by the params[:page] variable.
#
# ==== Pagination for a single action
#
@@ -47,7 +47,7 @@ module ActionController
# ==== Custom/"classic" pagination
#
# def list
- # @person_pages = Paginator.new self, Person.count, 10, @params['page']
+ # @person_pages = Paginator.new self, Person.count, 10, params[:page]
# @people = Person.find :all, :order => 'last_name, first_name',
# :limit => @person_pages.items_per_page,
# :offset => @person_pages.current.offset
diff --git a/tracks/vendor/rails/actionpack/lib/action_controller/request.rb b/tracks/vendor/rails/actionpack/lib/action_controller/request.rb
index 76257c1d..86547919 100644
--- a/tracks/vendor/rails/actionpack/lib/action_controller/request.rb
+++ b/tracks/vendor/rails/actionpack/lib/action_controller/request.rb
@@ -1,5 +1,6 @@
module ActionController
- # These methods are available in both the production and test Request objects.
+ # Subclassing AbstractRequest makes these methods available to the request objects used in production and testing,
+ # CgiRequest and TestRequest
class AbstractRequest
cattr_accessor :relative_url_root
@@ -65,6 +66,7 @@ module ActionController
end
end
+ # Returns the accepted MIME type for the request
def accepts
@accepts ||=
if @env['HTTP_ACCEPT'].to_s.strip.empty?
@@ -202,15 +204,21 @@ module ActionController
host + port_string
end
- def path_parameters=(parameters)
+ def path_parameters=(parameters) #:nodoc:
@path_parameters = parameters
@symbolized_path_parameters = @parameters = nil
end
- def symbolized_path_parameters
+ # The same as path_parameters with explicitly symbolized keys
+ def symbolized_path_parameters
@symbolized_path_parameters ||= path_parameters.symbolize_keys
end
+ # Returns a hash with the parameters used to form the path of the request
+ #
+ # Example:
+ #
+ # {:action => 'my_action', :controller => 'my_controller'}
def path_parameters
@path_parameters ||= {}
end
diff --git a/tracks/vendor/rails/actionpack/lib/action_controller/routing.rb b/tracks/vendor/rails/actionpack/lib/action_controller/routing.rb
index d6e287e0..ac40c63e 100644
--- a/tracks/vendor/rails/actionpack/lib/action_controller/routing.rb
+++ b/tracks/vendor/rails/actionpack/lib/action_controller/routing.rb
@@ -218,43 +218,81 @@ module ActionController
expr = "::#{controller.split('/').collect {|c| c.camelize}.join('::')}Controller"
g.result :controller, expr, true
end
-
+
+ def file_kinds(kind)
+ ((@file_kinds ||= []) << kind).uniq! || @file_kinds
+ end
+
def traverse_to_controller(segments, start_at = 0)
mod = ::Object
length = segments.length
index = start_at
mod_name = controller_name = segment = nil
-
while index < length
- return nil unless /^[A-Za-z][A-Za-z\d_]*$/ =~ (segment = segments[index])
+ return nil unless /\A[A-Za-z][A-Za-z\d_]*\Z/ =~ (segment = segments[index])
index += 1
+ file_kinds :app
mod_name = segment.camelize
controller_name = "#{mod_name}Controller"
+ path_suffix = File.join(segments[start_at..(index - 1)])
+ next_mod = nil
- begin
- # We use eval instead of const_get to avoid obtaining values from parent modules.
- controller = eval("mod::#{controller_name}", nil, __FILE__, __LINE__)
- expected_name = "#{mod.name}::#{controller_name}"
-
- # Detect the case when const_get returns an object from a parent namespace.
- if controller.is_a?(Class) && controller.ancestors.include?(ActionController::Base) && (mod == Object || controller.name == expected_name)
- return controller, (index - start_at)
+ # If the controller is already present, or if we load it, return it.
+ if mod.const_defined?(controller_name) || attempt_load(mod, controller_name, path_suffix + "_controller") == :defined
+ controller = mod.const_get(controller_name)
+ return nil unless controller.is_a?(Class) && controller.ancestors.include?(ActionController::Base) # it's not really a controller?
+ return [controller, (index - start_at)]
+ end
+
+ # No controller? Look for the module
+ if mod.const_defined? mod_name
+ next_mod = mod.send(:const_get, mod_name)
+ next_mod = nil unless next_mod.is_a?(Module)
+ else
+ # Try to load a file that defines the module we want.
+ case attempt_load(mod, mod_name, path_suffix)
+ when :defined then next_mod = mod.const_get mod_name
+ when :dir then # We didn't find a file, but there's a dir.
+ next_mod = Module.new # So create a module for the directory
+ mod.send :const_set, mod_name, next_mod
+ else
+ return nil
end
- rescue NameError => e
- raise unless /^uninitialized constant .*#{controller_name}$/ =~ e.message
end
+ mod = next_mod
- begin
- next_mod = eval("mod::#{mod_name}", nil, __FILE__, __LINE__)
- # Check that we didn't get a module from a parent namespace
- mod = (mod == Object || next_mod.name == "#{mod.name}::#{mod_name}") ? next_mod : nil
- rescue NameError => e
- raise unless /^uninitialized constant .*#{mod_name}$/ =~ e.message
- end
-
- return nil unless mod
+ return nil unless mod && mod.is_a?(Module)
end
+ nil
+ end
+
+ protected
+ def safe_load_paths #:nodoc:
+ if defined?(RAILS_ROOT)
+ $LOAD_PATH.select do |base|
+ base = File.expand_path(base)
+ extended_root = File.expand_path(RAILS_ROOT)
+ base.match(/\A#{Regexp.escape(extended_root)}\/*#{file_kinds(:lib) * '|'}/) || base =~ %r{rails-[\d.]+/builtin}
+ end
+ else
+ $LOAD_PATH
+ end
+ end
+
+ def attempt_load(mod, const_name, path)
+ has_dir = false
+ safe_load_paths.each do |load_path|
+ full_path = File.join(load_path, path)
+ file_path = full_path + '.rb'
+ if File.file?(file_path) # Found a .rb file? Load it up
+ require_dependency(file_path)
+ return :defined if mod.const_defined? const_name
+ else
+ has_dir ||= File.directory?(full_path)
+ end
+ end
+ return (has_dir ? :dir : nil)
end
end
end
diff --git a/tracks/vendor/rails/actionpack/lib/action_controller/streaming.rb b/tracks/vendor/rails/actionpack/lib/action_controller/streaming.rb
index 2c4e76f3..618888d0 100644
--- a/tracks/vendor/rails/actionpack/lib/action_controller/streaming.rb
+++ b/tracks/vendor/rails/actionpack/lib/action_controller/streaming.rb
@@ -14,7 +14,7 @@ module ActionController #:nodoc:
# it feasible to send even large files.
#
# Be careful to sanitize the path parameter if it coming from a web
- # page. send_file(@params['path']) allows a malicious user to
+ # page. send_file(params[:path]) allows a malicious user to
# download any file on your server.
#
# Options:
@@ -28,6 +28,7 @@ module ActionController #:nodoc:
# or to read the entire file before sending (false). Defaults to true.
# * :buffer_size - specifies size (in bytes) of the buffer used to stream the file.
# Defaults to 4096.
+ # * :status - specifies the status code to send with the response. Defaults to '200 OK'.
#
# The default Content-Type and Content-Disposition headers are
# set to download arbitrary binary files in as many browsers as
@@ -37,9 +38,12 @@ module ActionController #:nodoc:
# Simple download:
# send_file '/path/to.zip'
#
- # Show a JPEG in browser:
+ # Show a JPEG in the browser:
# send_file '/path/to.jpeg', :type => 'image/jpeg', :disposition => 'inline'
#
+ # Show a 404 page in the browser:
+ # send_file '/path/to/404.html, :type => 'text/html; charset=utf-8', :status => 404
+ #
# Read about the other Content-* HTTP headers if you'd like to
# provide the user with more information (such as Content-Description).
# http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.11
@@ -61,7 +65,7 @@ module ActionController #:nodoc:
@performed_render = false
if options[:stream]
- render :text => Proc.new { |response, output|
+ render :status => options[:status], :text => Proc.new { |response, output|
logger.info "Streaming file #{path}" unless logger.nil?
len = options[:buffer_size] || 4096
File.open(path, 'rb') do |file|
@@ -81,7 +85,7 @@ module ActionController #:nodoc:
}
else
logger.info "Sending file #{path}" unless logger.nil?
- File.open(path, 'rb') { |file| render :text => file.read }
+ File.open(path, 'rb') { |file| render :status => options[:status], :text => file.read }
end
end
@@ -93,6 +97,7 @@ module ActionController #:nodoc:
# * :type - specifies an HTTP content type.
# Defaults to 'application/octet-stream'.
# * :disposition - specifies whether the file will be shown inline or downloaded.
+ # * :status - specifies the status code to send with the response. Defaults to '200 OK'.
# Valid values are 'inline' and 'attachment' (default).
#
# Generic data download:
@@ -109,7 +114,7 @@ module ActionController #:nodoc:
logger.info "Sending data #{options[:filename]}" unless logger.nil?
send_file_headers! options.merge(:length => data.size)
@performed_render = false
- render :text => data
+ render :status => options[:status], :text => data
end
private
@@ -139,4 +144,4 @@ module ActionController #:nodoc:
@headers['Cache-Control'] = 'private' if @headers['Cache-Control'] == 'no-cache'
end
end
-end
\ No newline at end of file
+end
diff --git a/tracks/vendor/rails/actionpack/lib/action_controller/templates/scaffolds/layout.rhtml b/tracks/vendor/rails/actionpack/lib/action_controller/templates/scaffolds/layout.rhtml
index 120f0cfb..759781e0 100644
--- a/tracks/vendor/rails/actionpack/lib/action_controller/templates/scaffolds/layout.rhtml
+++ b/tracks/vendor/rails/actionpack/lib/action_controller/templates/scaffolds/layout.rhtml
@@ -63,7 +63,7 @@
<%= flash[:notice] %>
-<%= @content_for_layout %>
+<%= yield %>