Permalink
Browse files

Merge branch 'master' of git://github.com/rails/rails

  • Loading branch information...
2 parents 9d54f89 + ec53b80 commit 19965402b2f868c79d78269ca17cb6282f271382 @dmitry dmitry committed Oct 1, 2011
Showing with 1,492 additions and 668 deletions.
  1. +4 −4 Gemfile
  2. +2 −0 actionmailer/README.rdoc
  3. +2 −2 actionmailer/lib/action_mailer/base.rb
  4. +1 −1 actionmailer/test/mailers/base_mailer.rb
  5. +48 −0 actionpack/CHANGELOG
  6. +5 −0 actionpack/Rakefile
  7. +3 −6 actionpack/lib/action_controller/metal/params_wrapper.rb
  8. +1 −0 actionpack/lib/action_controller/vendor/html-scanner/html/sanitizer.rb
  9. +4 −0 actionpack/lib/action_dispatch/http/mime_type.rb
  10. +2 −2 actionpack/lib/action_dispatch/middleware/show_exceptions.rb
  11. +4 −3 actionpack/lib/action_dispatch/routing/route_set.rb
  12. +4 −4 actionpack/lib/action_dispatch/testing/integration.rb
  13. +1 −1 actionpack/lib/action_view/helpers/asset_tag_helpers/stylesheet_tag_helpers.rb
  14. +15 −5 actionpack/lib/action_view/helpers/url_helper.rb
  15. +111 −116 actionpack/lib/action_view/lookup_context.rb
  16. +16 −11 actionpack/lib/action_view/renderer/abstract_renderer.rb
  17. +11 −12 actionpack/lib/action_view/renderer/partial_renderer.rb
  18. +11 −13 actionpack/lib/action_view/renderer/template_renderer.rb
  19. +1 −3 actionpack/lib/action_view/test_case.rb
  20. +32 −35 actionpack/lib/sprockets/assets.rake
  21. +37 −0 actionpack/lib/sprockets/bootstrap.rb
  22. +46 −0 actionpack/lib/sprockets/compressors.rb
  23. +17 −7 actionpack/lib/sprockets/helpers/rails_helper.rb
  24. +6 −55 actionpack/lib/sprockets/railtie.rb
  25. +52 −0 actionpack/lib/sprockets/static_compiler.rb
  26. +3 −3 actionpack/test/abstract/abstract_controller_test.rb
  27. +1 −1 actionpack/test/controller/caching_test.rb
  28. +5 −6 actionpack/test/controller/integration_test.rb
  29. +2 −2 actionpack/test/controller/layout_test.rb
  30. +5 −5 actionpack/test/controller/new_base/render_file_test.rb
  31. +5 −5 actionpack/test/controller/new_base/render_partial_test.rb
  32. +3 −3 actionpack/test/controller/new_base/render_template_test.rb
  33. +15 −17 actionpack/test/controller/render_test.rb
  34. +2 −0 actionpack/test/dispatch/mime_type_test.rb
  35. +11 −0 actionpack/test/dispatch/routing_test.rb
  36. +1 −1 actionpack/test/dispatch/session/cookie_store_test.rb
  37. +1 −0 actionpack/test/fixtures/comments/empty.de.html.erb
  38. +1 −0 actionpack/test/fixtures/comments/empty.html.builder
  39. +1 −0 actionpack/test/fixtures/comments/empty.html.erb
  40. +1 −0 actionpack/test/fixtures/comments/empty.xml.erb
  41. +1 −1 actionpack/test/fixtures/test/_layout_with_partial_and_yield.html.erb
  42. +4 −0 actionpack/test/template/asset_tag_helper_test.rb
  43. +8 −8 actionpack/test/template/compiled_templates_test.rb
  44. +29 −0 actionpack/test/template/compressors_test.rb
  45. +1 −1 actionpack/test/template/log_subscriber_test.rb
  46. +0 −10 actionpack/test/template/lookup_context_test.rb
  47. +58 −21 actionpack/test/template/render_test.rb
  48. +48 −2 actionpack/test/template/sprockets_helper_test.rb
  49. +8 −8 actionpack/test/template/streaming_render_test.rb
  50. +4 −0 actionpack/test/template/url_helper_test.rb
  51. +25 −2 activemodel/lib/active_model/serialization.rb
  52. +7 −13 activemodel/lib/active_model/serializers/json.rb
  53. +15 −31 activemodel/lib/active_model/serializers/xml.rb
  54. +9 −0 activemodel/test/cases/serialization_test.rb
  55. +20 −0 activemodel/test/cases/serializers/json_serialization_test.rb
  56. +17 −0 activemodel/test/cases/serializers/xml_serialization_test.rb
  57. +25 −1 activerecord/CHANGELOG
  58. +1 −1 activerecord/lib/active_record/associations.rb
  59. +6 −5 activerecord/lib/active_record/associations/association_scope.rb
  60. +5 −1 activerecord/lib/active_record/associations/belongs_to_association.rb
  61. +1 −1 activerecord/lib/active_record/associations/collection_proxy.rb
  62. +0 −1 activerecord/lib/active_record/attribute_methods/primary_key.rb
  63. +4 −0 activerecord/lib/active_record/base.rb
  64. +11 −15 activerecord/lib/active_record/reflection.rb
  65. +29 −0 activerecord/lib/active_record/relation/query_methods.rb
  66. +1 −1 activerecord/lib/active_record/serializers/xml_serializer.rb
  67. +8 −0 activerecord/test/cases/associations/belongs_to_associations_test.rb
  68. +8 −0 activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb
  69. +19 −0 activerecord/test/cases/associations/has_many_associations_test.rb
  70. +16 −0 activerecord/test/cases/primary_keys_test.rb
  71. +5 −2 activerecord/test/cases/query_cache_test.rb
  72. +1 −1 activerecord/test/cases/reflection_test.rb
  73. +4 −0 activeresource/lib/active_resource/base.rb
  74. +4 −1 activeresource/lib/active_resource/connection.rb
  75. +6 −0 activeresource/test/cases/authorization_test.rb
  76. +11 −3 activeresource/test/cases/base_test.rb
  77. +2 −0 activesupport/CHANGELOG
  78. +8 −9 activesupport/lib/active_support/cache/file_store.rb
  79. +1 −3 activesupport/lib/active_support/core_ext/module/reachable.rb
  80. +1 −1 activesupport/lib/active_support/core_ext/object/to_query.rb
  81. +16 −3 activesupport/lib/active_support/core_ext/string/inflections.rb
  82. +3 −3 activesupport/lib/active_support/core_ext/string/output_safety.rb
  83. +46 −0 activesupport/lib/active_support/inflector/methods.rb
  84. +2 −2 activesupport/lib/active_support/json/encoding.rb
  85. +10 −4 activesupport/lib/active_support/message_encryptor.rb
  86. +15 −4 activesupport/lib/active_support/message_verifier.rb
  87. +10 −1 activesupport/test/caching_test.rb
  88. +37 −0 activesupport/test/constantize_test_cases.rb
  89. +8 −8 activesupport/test/core_ext/hash_ext_test.rb
  90. +9 −0 activesupport/test/core_ext/object/to_query_test.rb
  91. +22 −1 activesupport/test/core_ext/string_ext_test.rb
  92. +10 −17 activesupport/test/inflector_test.rb
  93. +25 −2 activesupport/test/message_encryptor_test.rb
  94. +25 −1 activesupport/test/message_verifier_test.rb
  95. +14 −0 railties/CHANGELOG
  96. +1 −1 railties/README.rdoc
  97. BIN railties/guides/assets/images/i18n/demo_html_safe.png
  98. +1 −1 railties/guides/source/action_view_overview.textile
  99. +2 −2 railties/guides/source/active_record_validations_callbacks.textile
  100. +9 −9 railties/guides/source/active_support_core_extensions.textile
  101. +3 −1 railties/guides/source/ajax_on_rails.textile
  102. +1 −1 railties/guides/source/api_documentation_guidelines.textile
  103. +78 −51 railties/guides/source/asset_pipeline.textile
  104. +1 −1 railties/guides/source/configuring.textile
  105. +4 −0 railties/guides/source/contributing_to_ruby_on_rails.textile
  106. +39 −4 railties/guides/source/i18n.textile
  107. +1 −1 railties/guides/source/initialization.textile
  108. +1 −1 railties/guides/source/ruby_on_rails_guides_guidelines.textile
  109. +3 −3 railties/guides/source/security.textile
  110. +3 −4 railties/lib/rails/application.rb
  111. +8 −8 railties/lib/rails/application/bootstrap.rb
  112. +4 −2 railties/lib/rails/application/configuration.rb
  113. +2 −2 railties/lib/rails/engine.rb
  114. +2 −2 railties/lib/rails/generators/actions.rb
  115. +4 −1 railties/lib/rails/generators/rails/plugin_new/templates/Gemfile
  116. +6 −2 railties/lib/rails/initializable.rb
  117. +1 −1 railties/lib/rails/test_help.rb
  118. +95 −51 railties/test/application/assets_test.rb
  119. +4 −4 railties/test/application/configuration_test.rb
  120. +8 −0 railties/test/application/middleware_test.rb
  121. +16 −0 railties/test/generators/actions_test.rb
  122. +10 −3 railties/test/initializable_test.rb
  123. +9 −0 railties/test/isolation/abstract_unit.rb
View
@@ -63,7 +63,7 @@ platforms :ruby do
gem "nokogiri", ">= 1.4.5"
# AR
- gem "sqlite3", "~> 1.3.3"
+ gem "sqlite3", "~> 1.3.4"
group :db do
gem "pg", ">= 0.11.0" unless ENV['TRAVIS'] # once pg is on travis this can be removed
@@ -75,16 +75,16 @@ end
platforms :jruby do
gem "ruby-debug", ">= 0.10.3"
gem "json"
- gem "activerecord-jdbcsqlite3-adapter"
+ gem "activerecord-jdbcsqlite3-adapter", ">= 1.2.0"
# This is needed by now to let tests work on JRuby
# TODO: When the JRuby guys merge jruby-openssl in
# jruby this will be removed
gem "jruby-openssl"
group :db do
- gem "activerecord-jdbcmysql-adapter"
- gem "activerecord-jdbcpostgresql-adapter"
+ gem "activerecord-jdbcmysql-adapter", ">= 1.2.0"
+ gem "activerecord-jdbcpostgresql-adapter", ">= 1.2.0"
end
end
View
@@ -59,6 +59,8 @@ generated would look like this:
Mr. david@loudthinking.com
+ Thank you for signing up!
+
In previous version of Rails you would call <tt>create_method_name</tt> and
<tt>deliver_method_name</tt>. Rails 3.0 has a much simpler interface, you
simply call the method and optionally call +deliver+ on the return value.
@@ -100,12 +100,12 @@ module ActionMailer #:nodoc:
# You can even use Action Pack helpers in these views. For example:
#
# You got a new note!
- # <%= truncate(@note.body, 25) %>
+ # <%= truncate(@note.body, :length => 25) %>
#
# If you need to access the subject, from or the recipients in the view, you can do that through message object:
#
# You got a new note from <%= message.from %>!
- # <%= truncate(@note.body, 25) %>
+ # <%= truncate(@note.body, :length => 25) %>
#
#
# = Generating URLs
@@ -113,6 +113,6 @@ def different_layout(layout_name='')
end
def email_with_translations
- mail :body => render("email_with_translations.html")
+ mail :body => render("email_with_translations", :formats => [:html])
end
end
View
@@ -1,5 +1,13 @@
*Rails 3.2.0 (unreleased)*
+* Passing formats or handlers to render :template and friends is deprecated. For example: [Nick Sutterer & José Valim]
+
+ render :template => "foo.html.erb"
+
+ Instead, you can provide :handlers and :formats directly as option:
+
+ render :template => "foo", :formats => [:html, :js], :handlers => :erb
+
* Changed log level of warning for missing CSRF token from :debug to :warn. [Mike Dillon]
* content_tag_for and div_for can now take the collection of records. It will also yield the record as the first argument if you set a receiving argument in your block [Prem Sichanugrist]
@@ -48,6 +56,46 @@
*Rails 3.1.1 (unreleased)*
+* javascript_path and stylesheet_path now refer to /assets if asset pipelining
+is on. [Santiago Pastorino]
+
+* button_to support form option. Now you're able to pass for example
+'data-type' => 'json'. [ihower]
+
+* image_path and image_tag should use /assets if asset pipelining is turned
+on. Closes #3126 [Santiago Pastorino and christos]
+
+* Avoid use of existing precompiled assets during rake assets:precompile run.
+Closes #3119 [Guillermo Iguaran]
+
+* Copy assets to nondigested filenames too [Santiago Pastorino]
+
+* Give precedence to `config.digest = false` over the existence of
+manifest.yml asset digests [christos]
+
+* escape options for the stylesheet_link_tag method [Alexey Vakhov]
+
+* Re-launch assets:precompile task using (Rake.)ruby instead of Kernel.exec so
+it works on Windows [cablegram]
+
+* env var passed to process shouldn't be modified in process method. [Santiago
+Pastorino]
+
+* `rake assets:precompile` loads the application but does not initialize
+it.
+
+ To the app developer, this means configuration add in
+ config/initializers/* will not be executed.
+
+ Plugins developers need to special case their initializers that are
+ meant to be run in the assets group by adding :group => :assets. [José Valim]
+
+* Sprockets uses config.assets.prefix for asset_path [asee]
+
+* FileStore key_file_path properly limit filenames to 255 characters. [phuibonhoa]
+
+* Fix Hash#to_query edge case with html_safe strings. [brainopia]
+
* Allow asset tag helper methods to accept :digest => false option in order to completely avoid the digest generation.
Useful for linking assets from static html files or from emails when the user
could probably look at an older html email with an older asset. [Santiago Pastorino]
View
@@ -26,6 +26,11 @@ namespace :test do
Rake::TestTask.new(:isolated) do |t|
t.pattern = 'test/ts_isolated.rb'
end
+
+ Rake::TestTask.new(:template) do |t|
+ t.libs << 'test'
+ t.pattern = 'test/template/**/*.rb'
+ end
end
desc 'ActiveRecord Integration Tests'
@@ -141,19 +141,16 @@ def inherited(klass)
# try to find Foo::Bar::User, Foo::User and finally User.
def _default_wrap_model #:nodoc:
return nil if self.anonymous?
-
model_name = self.name.sub(/Controller$/, '').singularize
begin
- model_klass = model_name.constantize
- rescue NameError, ArgumentError => e
- if e.message =~ /is not missing constant|uninitialized constant #{model_name}/
+ if model_klass = model_name.safe_constantize
+ model_klass
+ else
namespaces = model_name.split("::")
namespaces.delete_at(-2)
break if namespaces.last == model_name
model_name = namespaces.join("::")
- else
- raise
end
end until model_klass
@@ -1,4 +1,5 @@
require 'set'
+require 'cgi'
require 'active_support/core_ext/class/attribute'
module HTML
@@ -256,6 +256,10 @@ def html?
@@html_types.include?(to_sym) || @string =~ /html/
end
+ def respond_to?(method, include_private = false) #:nodoc:
+ super || method.to_s =~ /(\w+)\?$/
+ end
+
private
def method_missing(method, *args)
if method.to_s =~ /(\w+)\?$/
@@ -86,8 +86,8 @@ def rescue_action_locally(request, exception)
:framework_trace => framework_trace(exception),
:full_trace => full_trace(exception)
)
- file = "rescues/#{@@rescue_templates[exception.class.name]}.erb"
- body = template.render(:file => file, :layout => 'rescues/layout.erb')
+ file = "rescues/#{@@rescue_templates[exception.class.name]}"
+ body = template.render(:template => file, :layout => 'rescues/layout')
render(status_code(exception), body)
end
@@ -165,13 +165,14 @@ def define_hash_access(route, name, kind, options)
remove_possible_method :#{selector}
def #{selector}(*args)
options = args.extract_options!
+ result = #{options.inspect}
if args.any?
- options[:_positional_args] = args
- options[:_positional_keys] = #{route.segment_keys.inspect}
+ result[:_positional_args] = args
+ result[:_positional_keys] = #{route.segment_keys.inspect}
end
- options ? #{options.inspect}.merge(options) : #{options.inspect}
+ result.merge(options)
end
protected :#{selector}
END_EVAL
@@ -241,8 +241,8 @@ def _mock_session
end
# Performs the actual request.
- def process(method, path, parameters = nil, env = nil)
- env ||= {}
+ def process(method, path, parameters = nil, rack_env = nil)
+ rack_env ||= {}
if path =~ %r{://}
location = URI.parse(path)
https! URI::HTTPS === location if location.scheme
@@ -258,7 +258,7 @@ def process(method, path, parameters = nil, env = nil)
hostname, port = host.split(':')
- default_env = {
+ env = {
:method => method,
:params => parameters,
@@ -276,7 +276,7 @@ def process(method, path, parameters = nil, env = nil)
session = Rack::Test::Session.new(_mock_session)
- env.reverse_merge!(default_env)
+ env.merge!(rack_env)
# NOTE: rack-test v0.5 doesn't build a default uri correctly
# Make sure requested path is always a full uri
@@ -17,7 +17,7 @@ def extension
def asset_tag(source, options)
# We force the :request protocol here to avoid a double-download bug in IE7 and IE8
- tag("link", { "rel" => "stylesheet", "type" => Mime::CSS, "media" => "screen", "href" => ERB::Util.html_escape(path_to_asset(source, :protocol => :request)) }.merge(options), false, false)
+ tag("link", { "rel" => "stylesheet", "type" => Mime::CSS, "media" => "screen", "href" => path_to_asset(source, :protocol => :request) }.merge(options))
end
def custom_dir
@@ -279,6 +279,7 @@ def link_to(*args, &block)
# processed normally, otherwise no action is taken.
# * <tt>:remote</tt> - If set to true, will allow the Unobtrusive JavaScript drivers to control the
# submit behavior. By default this behavior is an ajax submit.
+ # * <tt>:form</tt> - This hash will be form attributes
# * <tt>:form_class</tt> - This controls the class of the form within which the submit button will
# be placed
#
@@ -295,6 +296,12 @@ def link_to(*args, &block)
# # </form>"
#
#
+ # <%= button_to "Create", :action => "create", :remote => true, :form => { "data-type" => "json" } %>
+ # # => "<form method="post" action="/images/create" class="button_to" data-remote="true" data-type="json">
+ # # <div><input value="Create" type="submit" /></div>
+ # # </form>"
+ #
+ #
# <%= button_to "Delete Image", { :action => "delete", :id => @image.id },
# :confirm => "Are you sure?", :method => :delete %>
# # => "<form method="post" action="/images/delete/1" class="button_to">
@@ -324,10 +331,11 @@ def button_to(name, options = {}, html_options = {})
end
form_method = method.to_s == 'get' ? 'get' : 'post'
- form_class = html_options.delete('form_class') || 'button_to'
-
+ form_options = html_options.delete('form') || {}
+ form_options[:class] ||= html_options.delete('form_class') || 'button_to'
+
remote = html_options.delete('remote')
-
+
request_token_tag = ''
if form_method == 'post' && protect_against_forgery?
request_token_tag = tag(:input, :type => "hidden", :name => request_forgery_protection_token.to_s, :value => form_authenticity_token)
@@ -340,8 +348,10 @@ def button_to(name, options = {}, html_options = {})
html_options.merge!("type" => "submit", "value" => name)
- ("<form method=\"#{form_method}\" action=\"#{ERB::Util.html_escape(url)}\" #{"data-remote=\"true\"" if remote} class=\"#{ERB::Util.html_escape(form_class)}\"><div>" +
- method_tag + tag("input", html_options) + request_token_tag + "</div></form>").html_safe
+ form_options.merge!(:method => form_method, :action => url)
+ form_options.merge!("data-remote" => "true") if remote
+
+ "#{tag(:form, form_options, true)}<div>#{method_tag}#{tag("input", html_options)}#{request_token_tag}</div></form>".html_safe
end
Oops, something went wrong.

0 comments on commit 1996540

Please sign in to comment.