Permalink
Browse files

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

  • Loading branch information...
2 parents 79f02a4 + 4adcbb6 commit 965fe59bff249ad91131a444e1fbd63dc4411db3 @mikel mikel committed Mar 11, 2010
Showing with 3,428 additions and 1,979 deletions.
  1. +6 −12 Gemfile
  2. +21 −1 Rakefile
  3. +1 −1 actionmailer/README
  4. +5 −17 actionmailer/Rakefile
  5. +3 −2 actionmailer/actionmailer.gemspec
  6. +1 −1 actionmailer/lib/action_mailer/base.rb
  7. +4 −4 actionmailer/lib/action_mailer/railtie.rb
  8. +1 −1 actionmailer/lib/action_mailer/version.rb
  9. +2 −1 actionmailer/test/base_test.rb
  10. +7 −0 actionpack/Rakefile
  11. +5 −4 actionpack/actionpack.gemspec
  12. +2 −0 actionpack/lib/action_controller/metal/compatibility.rb
  13. +9 −1 actionpack/lib/action_controller/metal/url_for.rb
  14. +1 −0 actionpack/lib/action_controller/railtie.rb
  15. +1 −2 actionpack/lib/action_controller/railties/subscriber.rb
  16. +0 −14 actionpack/lib/action_dispatch/middleware/show_exceptions.rb
  17. +2 −1 actionpack/lib/action_dispatch/routing/route_set.rb
  18. +1 −1 actionpack/lib/action_pack/version.rb
  19. +2 −0 actionpack/lib/action_view/helpers.rb
  20. +12 −0 actionpack/lib/action_view/helpers/csrf_helper.rb
  21. +12 −8 actionpack/lib/action_view/helpers/form_helper.rb
  22. +3 −3 actionpack/lib/action_view/helpers/form_tag_helper.rb
  23. +1 −1 actionpack/lib/action_view/helpers/javascript_helper.rb
  24. +1 −1 actionpack/lib/action_view/helpers/tag_helper.rb
  25. +4 −4 actionpack/lib/action_view/helpers/text_helper.rb
  26. +1 −1 actionpack/lib/action_view/render/rendering.rb
  27. +16 −1 actionpack/test/controller/request_forgery_protection_test.rb
  28. +1 −1 actionpack/test/controller/subscriber_test.rb
  29. +10 −0 actionpack/test/dispatch/routing_test.rb
  30. +22 −0 actionpack/test/template/form_helper_test.rb
  31. +14 −0 actionpack/test/template/text_helper_test.rb
  32. +11 −0 activemodel/CHANGELOG
  33. +0 −12 activemodel/CHANGES
  34. +10 −3 activemodel/Rakefile
  35. +3 −2 activemodel/activemodel.gemspec
  36. +1 −1 activemodel/lib/active_model/version.rb
  37. +5 −0 activerecord/CHANGELOG
  38. +5 −17 activerecord/Rakefile
  39. +5 −4 activerecord/activerecord.gemspec
  40. +1 −1 activerecord/lib/active_record.rb
  41. +4 −3 activerecord/lib/active_record/base.rb
  42. +0 −79 activerecord/lib/active_record/batches.rb
  43. +8 −4 activerecord/lib/active_record/connection_adapters/mysql_adapter.rb
  44. +2 −2 activerecord/lib/active_record/migration.rb
  45. +4 −2 activerecord/lib/active_record/railtie.rb
  46. +1 −1 activerecord/lib/active_record/relation.rb
  47. +78 −0 activerecord/lib/active_record/relation/batches.rb
  48. +1 −1 activerecord/lib/active_record/version.rb
  49. +3 −3 activerecord/test/cases/validations_test.rb
  50. +5 −16 activeresource/Rakefile
  51. +4 −3 activeresource/activeresource.gemspec
  52. +1 −1 activeresource/lib/active_resource/version.rb
  53. +1 −0 activeresource/test/abstract_unit.rb
  54. +6 −0 activeresource/test/cases/base_test.rb
  55. +2 −1 activeresource/test/cases/subscriber_test.rb
  56. +5 −0 activesupport/CHANGELOG
  57. +5 −17 activesupport/Rakefile
  58. +2 −1 activesupport/activesupport.gemspec
  59. +1 −0 activesupport/lib/active_support/core_ext/class.rb
  60. +55 −0 activesupport/lib/active_support/core_ext/class/subclasses.rb
  61. +1 −1 activesupport/lib/active_support/core_ext/file/atomic.rb
  62. +0 −1 activesupport/lib/active_support/core_ext/kernel.rb
  63. +0 −7 activesupport/lib/active_support/core_ext/kernel/daemonizing.rb
  64. +1 −1 activesupport/lib/active_support/core_ext/kernel/debugger.rb
  65. +3 −3 activesupport/lib/active_support/core_ext/module.rb
  66. +24 −0 activesupport/lib/active_support/core_ext/module/anonymous.rb
  67. +0 −30 activesupport/lib/active_support/core_ext/module/inclusion.rb
  68. +0 −25 activesupport/lib/active_support/core_ext/module/loading.rb
  69. +10 −0 activesupport/lib/active_support/core_ext/module/reachable.rb
  70. +6 −0 activesupport/lib/active_support/core_ext/object.rb
  71. +11 −0 activesupport/lib/active_support/core_ext/object/extending.rb
  72. +2 −5 activesupport/lib/active_support/core_ext/string/output_safety.rb
  73. +1 −1 activesupport/lib/active_support/core_ext/string/xchar.rb
  74. +137 −191 activesupport/lib/active_support/dependencies.rb
  75. +40 −0 activesupport/lib/active_support/json/backends/yajl.rb
  76. +16 −1 activesupport/lib/active_support/json/decoding.rb
  77. +0 −6 activesupport/lib/active_support/test_case.rb
  78. +1 −1 activesupport/lib/active_support/version.rb
  79. +1 −1 activesupport/lib/active_support/whiny_nil.rb
  80. +29 −0 activesupport/test/core_ext/class_test.rb
  81. +14 −0 activesupport/test/core_ext/module/anonymous_test.rb
  82. +41 −0 activesupport/test/core_ext/module/reachable_test.rb
  83. +0 −12 activesupport/test/core_ext/module_test.rb
  84. +50 −0 activesupport/test/core_ext/object_and_class_ext_test.rb
  85. +20 −17 activesupport/test/core_ext/string_ext_test.rb
  86. +11 −16 activesupport/test/dependencies_test.rb
  87. +2 −1 activesupport/test/json/decoding_test.rb
  88. +7 −3 activesupport/test/json/encoding_test.rb
  89. +0 −6 activesupport/test/rescuable_test.rb
  90. +15 −12 ci/ci_build.rb
  91. +2 −2 load_paths.rb
  92. +12 −11 rails.gemspec
  93. +28 −0 rails3b.gemspec
  94. +2 −2 railties/README
  95. +5 −17 railties/Rakefile
  96. BIN railties/guides/images/edge_badge.png
  97. +10 −2 railties/guides/rails_guides/generator.rb
  98. +6 −5 railties/guides/source/3_0_release_notes.textile
  99. +3 −3 railties/guides/source/action_mailer_basics.textile
  100. +2 −2 railties/guides/source/action_view_overview.textile
  101. +544 −7 railties/guides/source/active_support_core_extensions.textile
  102. +2 −2 railties/guides/source/activerecord_validations_callbacks.textile
  103. +1 −1 railties/guides/source/caching_with_rails.textile
  104. +29 −29 railties/guides/source/command_line.textile
  105. +1 −1 railties/guides/source/contribute.textile
  106. +6 −6 railties/guides/source/debugging_rails_applications.textile
  107. +1 −1 railties/guides/source/form_helpers.textile
  108. +14 −14 railties/guides/source/generators.textile
  109. +1 −1 railties/guides/source/getting_started.textile
  110. +5 −5 railties/guides/source/migrations.textile
  111. +8 −8 railties/guides/source/performance_testing.textile
  112. +26 −24 railties/guides/source/plugins.textile
  113. +5 −5 railties/guides/source/rails_on_rack.textile
  114. +4 −4 railties/guides/source/testing.textile
  115. +2 −0 railties/lib/generators/erb/scaffold/templates/layout.html.erb
  116. +22 −22 railties/lib/generators/rails/app/templates/Gemfile
  117. +14 −0 railties/lib/generators/rails/app/templates/config/application.rb
  118. +0 −29 railties/lib/generators/rails/app/templates/config/boot.rb
  119. +20 −11 railties/lib/generators/rails/app/templates/config/databases/ibm_db.yml
  120. +5 −3 railties/lib/generators/rails/app/templates/public/javascripts/controls.js
  121. +7 −6 railties/lib/generators/rails/app/templates/public/javascripts/dragdrop.js
  122. +8 −13 railties/lib/generators/rails/app/templates/public/javascripts/effects.js
  123. +1,573 −1,019 railties/lib/generators/rails/app/templates/public/javascripts/prototype.js
  124. +37 −4 railties/lib/generators/rails/app/templates/public/javascripts/rails.js
  125. +0 −1 railties/lib/generators/rails/app/templates/script/rails
  126. +1 −1 railties/lib/generators/rails/app/templates/test/test_helper.rb
  127. +1 −1 railties/lib/generators/rails/controller/USAGE
  128. +1 −1 railties/lib/generators/rails/generator/USAGE
  129. +1 −1 railties/lib/generators/rails/generator/templates/USAGE.tt
  130. +1 −1 railties/lib/generators/rails/helper/USAGE
  131. +1 −1 railties/lib/generators/rails/integration_test/USAGE
  132. +1 −1 railties/lib/generators/rails/mailer/USAGE
  133. +1 −1 railties/lib/generators/rails/metal/USAGE
  134. +2 −2 railties/lib/generators/rails/migration/USAGE
  135. +2 −2 railties/lib/generators/rails/model/USAGE
  136. +1 −1 railties/lib/generators/rails/observer/USAGE
  137. +1 −1 railties/lib/generators/rails/performance_test/USAGE
  138. +1 −1 railties/lib/generators/rails/plugin/USAGE
  139. +3 −3 railties/lib/generators/rails/resource/USAGE
  140. +4 −4 railties/lib/generators/rails/scaffold/USAGE
  141. +1 −1 railties/lib/generators/rails/scaffold_controller/USAGE
  142. +1 −1 railties/lib/generators/rails/session_migration/USAGE
  143. +1 −1 railties/lib/generators/rails/stylesheets/USAGE
  144. +1 −4 railties/lib/rails/all.rb
  145. +0 −11 railties/lib/rails/backtrace_cleaner.rb
  146. +7 −7 railties/lib/rails/commands.rb
  147. +1 −1 railties/lib/rails/commands/console.rb
  148. +2 −2 railties/lib/rails/commands/destroy.rb
  149. +2 −2 railties/lib/rails/commands/generate.rb
  150. +2 −2 railties/lib/rails/commands/performance/benchmarker.rb
  151. +2 −2 railties/lib/rails/commands/performance/profiler.rb
  152. +6 −6 railties/lib/rails/commands/plugin.rb
  153. +2 −0 railties/lib/rails/commands/runner.rb
  154. +18 −8 railties/lib/rails/commands/server.rb
  155. +2 −1 railties/lib/rails/configuration.rb
  156. +21 −6 railties/lib/rails/deprecation.rb
  157. +5 −1 railties/lib/rails/engine.rb
  158. +1 −0 railties/lib/rails/engine/configuration.rb
  159. +7 −2 railties/lib/rails/generators.rb
  160. +4 −4 railties/lib/rails/generators/actions.rb
  161. +5 −6 railties/lib/rails/generators/base.rb
  162. +3 −1 railties/lib/rails/rack/debugger.rb
  163. +1 −1 railties/lib/rails/tasks/documentation.rake
  164. +6 −0 railties/lib/rails/test_help.rb
  165. +1 −1 railties/lib/rails/test_unit/railtie.rb
  166. +1 −1 railties/lib/rails/version.rb
  167. +4 −3 railties/railties.gemspec
  168. +4 −11 railties/test/application/generators_test.rb
  169. +17 −0 railties/test/application/test_test.rb
  170. +23 −5 railties/test/generators/actions_test.rb
  171. +5 −7 railties/test/generators/app_generator_test.rb
  172. +1 −0 railties/test/generators/generators_test_helper.rb
  173. +1 −1 railties/test/isolation/abstract_unit.rb
View
@@ -1,7 +1,7 @@
-path File.expand_path('..', __FILE__)
-source :gemcutter
+path File.dirname(__FILE__)
+source 'http://gemcutter.org'
-gem "rails", "3.0.0.beta"
+gem "rails", "3.0.0.beta1"
gem "rake", ">= 0.8.7"
gem "mocha", ">= 0.9.8"
@@ -11,26 +11,20 @@ if RUBY_VERSION < '1.9'
end
# AR
-gem "sqlite3-ruby", ">= 1.2.5"
+gem "sqlite3-ruby", ">= 1.2.5", :require => 'sqlite3'
group :test do
gem "pg", ">= 0.8.0"
gem "mysql", ">= 2.8.1"
end
# AP
-gem "rack-test", "0.5.3"
+gem "rack-test", "0.5.3", :require => 'rack/test'
gem "RedCloth", ">= 4.2.2"
if ENV['CI']
gem "nokogiri", ">= 1.4.0"
- gem "memcache-client", ">= 1.7.6"
# fcgi gem doesn't compile on 1.9
- # avoid minitest strangeness on 1.9
- if RUBY_VERSION < '1.9.0'
- gem "fcgi", ">= 0.8.7"
- else
- gem "test-unit", ">= 2.0.5"
- end
+ gem "fcgi", ">= 0.8.7" if RUBY_VERSION < '1.9.0'
end
View
@@ -13,7 +13,7 @@ end
desc 'Run all tests by default'
task :default => %w(test test:isolated)
-%w(test test:isolated rdoc pgem package release gem gemspec).each do |task_name|
+%w(test test:isolated rdoc pgem package gem gemspec).each do |task_name|
desc "Run #{task_name} task for all projects"
task task_name do
errors = []
@@ -37,6 +37,22 @@ Rake::GemPackageTask.new(spec) do |pkg|
pkg.gem_spec = spec
end
+desc "Release all gems to gemcutter. Package rails, package & push components, then push rails"
+task :release => :release_projects do
+ require 'rake/gemcutter'
+ Rake::Gemcutter::Tasks.new(spec).define
+ Rake::Task['gem:push'].invoke
+end
+
+desc "Release all components to gemcutter."
+task :release_projects => :package do
+ errors = []
+ PROJECTS.each do |project|
+ system(%(cd #{project} && #{env} #{$0} release)) || errors << project
+ end
+ fail("Errors in #{errors.join(', ')}") unless errors.empty?
+end
+
task :install => :gem do
(PROJECTS - ["railties"]).each do |project|
puts "INSTALLING #{project}"
@@ -88,6 +104,10 @@ Rake::RDocTask.new do |rdoc|
rdoc.rdoc_files.include('activesupport/CHANGELOG')
rdoc.rdoc_files.include('activesupport/lib/active_support/**/*.rb')
rdoc.rdoc_files.exclude('activesupport/lib/active_support/vendor/*')
+
+ rdoc.rdoc_files.include('activemodel/README')
+ rdoc.rdoc_files.include('activemodel/CHANGELOG')
+ rdoc.rdoc_files.include('activemodel/lib/active_model/**/*.rb')
end
# Enhance rdoc task to copy referenced images also
View
@@ -101,7 +101,7 @@ Example:
This Mailman can be the target for Postfix or other MTAs. In Rails, you would use the runner in the
trivial case like this:
- ./script/runner 'Mailman.receive(STDIN.read)'
+ rails runner 'Mailman.receive(STDIN.read)'
However, invoking Rails in the runner for each mail to be received is very resource intensive. A single
instance of Rails should be run within a daemon if it is going to be utilized to process more than just
View
@@ -54,27 +54,15 @@ Rake::GemPackageTask.new(spec) do |p|
p.gem_spec = spec
end
-desc "Publish the API documentation"
-task :pgem => [:package] do
- require 'rake/contrib/sshpublisher'
- Rake::SshFilePublisher.new("gems.rubyonrails.org", "/u/sites/gems/gems", "pkg", "#{PKG_FILE_NAME}.gem").upload
- `ssh gems.rubyonrails.org '/u/sites/gems/gemupdate.sh'`
+desc "Release to gemcutter"
+task :release => :package do
+ require 'rake/gemcutter'
+ Rake::Gemcutter::Tasks.new(spec).define
+ Rake::Task['gem:push'].invoke
end
desc "Publish the API documentation"
task :pdoc => [:rdoc] do
require 'rake/contrib/sshpublisher'
Rake::SshDirPublisher.new("wrath.rubyonrails.org", "public_html/am", "doc").upload
end
-
-desc "Publish the release files to RubyForge."
-task :release => [ :package ] do
- require 'rubyforge'
- require 'rake/contrib/rubyforgepublisher'
-
- packages = %w( gem tgz zip ).collect{ |ext| "pkg/#{PKG_NAME}-#{PKG_VERSION}.#{ext}" }
-
- rubyforge = RubyForge.new
- rubyforge.login
- rubyforge.add_release(PKG_NAME, PKG_NAME, "REL #{PKG_VERSION}", *packages)
-end
@@ -1,9 +1,10 @@
Gem::Specification.new do |s|
s.platform = Gem::Platform::RUBY
s.name = 'actionmailer'
- s.version = '3.0.0.beta'
+ s.version = '3.0.0.beta1'
s.summary = 'Email composition, delivery, and recieval framework (part of Rails).'
s.description = 'Email composition, delivery, and recieval framework (part of Rails).'
+ s.required_ruby_version = '>= 1.8.7'
s.author = 'David Heinemeier Hansson'
s.email = 'david@loudthinking.com'
@@ -16,7 +17,7 @@ Gem::Specification.new do |s|
s.has_rdoc = true
- s.add_dependency('actionpack', '= 3.0.0.beta')
+ s.add_dependency('actionpack', '= 3.0.0.beta1')
s.add_dependency('mail', '~> 2.1.2')
s.add_dependency('text-format', '~> 1.0.0')
end
@@ -9,7 +9,7 @@ module ActionMailer #:nodoc:
#
# To use Action Mailer, you need to create a mailer model.
#
- # $ script/generate mailer Notifier
+ # $ rails 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
@@ -5,6 +5,10 @@ module ActionMailer
class Railtie < Rails::Railtie
railtie_name :action_mailer
+ initializer "action_mailer.url_for", :before => :load_environment_config do |app|
+ ActionMailer::Base.send(:include, ActionController::UrlFor) if defined?(ActionController)
+ end
+
require "action_mailer/railties/subscriber"
subscriber ActionMailer::Railties::Subscriber.new
@@ -17,9 +21,5 @@ class Railtie < Rails::Railtie
ActionMailer::Base.send "#{k}=", v
end
end
-
- initializer "action_mailer.url_for" do |app|
- ActionMailer::Base.send(:include, ActionController::UrlFor) if defined?(ActionController)
- end
end
end
@@ -2,7 +2,7 @@ module ActionMailer
module VERSION #:nodoc:
MAJOR = 3
MINOR = 0
- TINY = "0.beta"
+ TINY = "0.beta1"
STRING = [MAJOR, MINOR, TINY].join('.')
end
@@ -461,7 +461,8 @@ def different_layout(layout_name='')
assert_instance_of Mail::Message, mail
end
- test "calling deliver on the action should increment the deliveries collection" do
+ test "calling deliver on the action should increment the deliveries collection if using the test mailer" do
+ BaseMailer.delivery_method = :test
BaseMailer.deliveries.clear
BaseMailer.welcome.deliver
assert_equal(1, BaseMailer.deliveries.length)
View
@@ -70,6 +70,13 @@ Rake::GemPackageTask.new(spec) do |p|
p.gem_spec = spec
end
+desc "Release to gemcutter"
+task :release => :package do
+ require 'rake/gemcutter'
+ Rake::Gemcutter::Tasks.new(spec).define
+ Rake::Task['gem:push'].invoke
+end
+
task :lines do
lines, codelines, total_lines, total_codelines = 0, 0, 0, 0
@@ -1,9 +1,10 @@
Gem::Specification.new do |s|
s.platform = Gem::Platform::RUBY
s.name = 'actionpack'
- s.version = '3.0.0.beta'
+ s.version = '3.0.0.beta1'
s.summary = 'Web-flow and rendering framework putting the VC in MVC (part of Rails).'
s.description = 'Web-flow and rendering framework putting the VC in MVC (part of Rails).'
+ s.required_ruby_version = '>= 1.8.7'
s.author = 'David Heinemeier Hansson'
s.email = 'david@loudthinking.com'
@@ -16,10 +17,10 @@ Gem::Specification.new do |s|
s.has_rdoc = true
- s.add_dependency('activesupport', '= 3.0.0.beta')
- s.add_dependency('activemodel', '= 3.0.0.beta')
+ s.add_dependency('activesupport', '= 3.0.0.beta1')
+ s.add_dependency('activemodel', '= 3.0.0.beta1')
s.add_dependency('rack', '~> 1.1.0')
s.add_dependency('rack-test', '~> 0.5.0')
- s.add_dependency('rack-mount', '~> 0.4.0')
+ s.add_dependency('rack-mount', '~> 0.4.7')
s.add_dependency('erubis', '~> 2.6.5')
end
@@ -76,6 +76,7 @@ def consider_all_requests_local
def consider_all_requests_local=(value)
ActiveSupport::Deprecation.warn "ActionController::Base.consider_all_requests_local= is no longer effective. " <<
"Please configure it on your application with config.consider_all_requests_local="
+ Rails.application.config.consider_all_requests_local = value
end
def allow_concurrency
@@ -87,6 +88,7 @@ def allow_concurrency
def allow_concurrency=(value)
ActiveSupport::Deprecation.warn "ActionController::Base.allow_concurrency= is no longer effective. " <<
"Please configure it on your application with config.allow_concurrency="
+ Rails.application.config.allow_concurrency = value
end
def rescue_action(env)
@@ -1,4 +1,5 @@
require 'active_support/core_ext/class/attribute'
+require 'active_support/core_ext/module/attribute_accessors'
module ActionController
# In <b>routes.rb</b> one defines URL-to-controller mappings, but the reverse
@@ -87,7 +88,14 @@ module UrlFor
included do
ActionController::Routing::Routes.install_helpers(self)
- class_attribute :default_url_options
+
+ # Including in a class uses an inheritable hash. Modules get a plain hash.
+ if respond_to?(:class_attribute)
+ class_attribute :default_url_options
+ else
+ mattr_accessor :default_url_options
+ end
+
self.default_url_options = {}
end
@@ -1,5 +1,6 @@
require "action_controller"
require "rails"
+require "action_view/railtie"
module ActionController
class Railtie < Rails::Railtie
@@ -15,9 +15,8 @@ def process_action(event)
payload = event.payload
additions = ActionController::Base.log_process_action(payload)
- message = "Completed in %.0fms" % event.duration
+ message = "Completed #{payload[:status]} #{Rack::Utils::HTTP_STATUS_CODES[payload[:status]]} in %.0fms" % event.duration
message << " (#{additions.join(" | ")})" unless additions.blank?
- message << " with #{payload[:status]}"
info(message)
end
@@ -5,20 +5,6 @@
module ActionDispatch
# This middleware rescues any exception returned by the application and renders
# nice exception pages if it's being rescued locally.
- #
- # Every time an exception is caught, a notification is published, becoming a good API
- # to deal with exceptions. So, if you want send an e-mail through ActionMailer
- # everytime this notification is published, you just need to do the following:
- #
- # ActiveSupport::Notifications.subscribe "action_dispatch.show_exception" do |name, start, end, instrumentation_id, payload|
- # ExceptionNotifier.deliver_exception(start, payload)
- # end
- #
- # The payload is a hash which has two pairs:
- #
- # * :env - Contains the rack env for the given request;
- # * :exception - The exception raised;
- #
class ShowExceptions
LOCALHOST = ['127.0.0.1', '::1'].freeze
@@ -44,7 +44,8 @@ def controller(params)
controller = "#{params[:controller].camelize}Controller"
ActiveSupport::Inflector.constantize(controller)
end
- rescue NameError
+ rescue NameError => e
+ raise unless e.message.include?(controller)
nil
end
@@ -2,7 +2,7 @@ module ActionPack #:nodoc:
module VERSION #:nodoc:
MAJOR = 3
MINOR = 0
- TINY = "0.beta"
+ TINY = "0.beta1"
STRING = [MAJOR, MINOR, TINY].join('.')
end
@@ -7,6 +7,7 @@ module Helpers #:nodoc:
autoload :AtomFeedHelper, 'action_view/helpers/atom_feed_helper'
autoload :CacheHelper, 'action_view/helpers/cache_helper'
autoload :CaptureHelper, 'action_view/helpers/capture_helper'
+ autoload :CsrfHelper, 'action_view/helpers/csrf_helper'
autoload :DateHelper, 'action_view/helpers/date_helper'
autoload :DebugHelper, 'action_view/helpers/debug_helper'
autoload :FormHelper, 'action_view/helpers/form_helper'
@@ -40,6 +41,7 @@ module ClassMethods
include AtomFeedHelper
include CacheHelper
include CaptureHelper
+ include CsrfHelper
include DateHelper
include DebugHelper
include FormHelper
@@ -0,0 +1,12 @@
+module ActionView
+ module Helpers
+ module CsrfHelper
+ # Returns a meta tag with the request forgery protection token for forms to use. Put this in your head.
+ def csrf_meta_tag
+ if protect_against_forgery?
+ %(<meta name="csrf-param" content="#{Rack::Utils.escape_html(request_forgery_protection_token)}"/>\n<meta name="csrf-token" content="#{Rack::Utils.escape_html(form_authenticity_token)}"/>).html_safe
+ end
+ end
+ end
+ end
+end
Oops, something went wrong.

0 comments on commit 965fe59

Please sign in to comment.