aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Gemfile2
-rw-r--r--actionpack/CHANGELOG.md21
-rw-r--r--actionpack/lib/action_view/asset_paths.rb2
-rw-r--r--actionpack/test/template/asset_tag_helper_test.rb40
-rw-r--r--activerecord/CHANGELOG.md4
-rw-r--r--activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb8
-rw-r--r--activerecord/test/cases/disconnected_test.rb26
-rw-r--r--railties/guides/source/caching_with_rails.textile4
-rw-r--r--railties/guides/source/layout.html.erb10
9 files changed, 95 insertions, 22 deletions
diff --git a/Gemfile b/Gemfile
index 6098cf78a1..4b8def733c 100644
--- a/Gemfile
+++ b/Gemfile
@@ -53,7 +53,7 @@ end
platforms :ruby do
gem 'yajl-ruby'
- gem 'nokogiri', '>= 1.4.5'
+ gem 'nokogiri', '>= 1.4.5', '< 1.6'
# AR
gem 'sqlite3', '~> 1.3.5'
diff --git a/actionpack/CHANGELOG.md b/actionpack/CHANGELOG.md
index 9d50342867..585cad24db 100644
--- a/actionpack/CHANGELOG.md
+++ b/actionpack/CHANGELOG.md
@@ -1,5 +1,26 @@
## unreleased ##
+* Use a case insensitive URI Regexp for #asset_path.
+
+ This fix a problem where the same asset path using different case are generating
+ different URIs.
+
+ Before:
+
+ image_tag("HTTP://google.com")
+ # => "<img alt=\"Google\" src=\"/assets/HTTP://google.com\" />"
+ image_tag("http://google.com")
+ # => "<img alt=\"Google\" src=\"http://google.com\" />"
+
+ After:
+
+ image_tag("HTTP://google.com")
+ # => "<img alt=\"Google\" src=\"HTTP://google.com\" />"
+ image_tag("http://google.com")
+ # => "<img alt=\"Google\" src=\"http://google.com\" />"
+
+ *David Celis + Rafael Mendonça França*
+
* Fix explicit names on multiple file fields. If a file field tag has
the multiple option, it is turned into an array field (appending `[]`),
but if an explicit name is passed to `file_field` the `[]` is not
diff --git a/actionpack/lib/action_view/asset_paths.rb b/actionpack/lib/action_view/asset_paths.rb
index c192d3704e..636a37b699 100644
--- a/actionpack/lib/action_view/asset_paths.rb
+++ b/actionpack/lib/action_view/asset_paths.rb
@@ -43,7 +43,7 @@ module ActionView
end
def is_uri?(path)
- path =~ %r{^[-a-z]+://|^(?:cid|data):|^//}
+ path =~ %r{^[-a-z]+://|^(?:cid|data):|^//}i
end
private
diff --git a/actionpack/test/template/asset_tag_helper_test.rb b/actionpack/test/template/asset_tag_helper_test.rb
index b1a01b53b1..6b1bc01f54 100644
--- a/actionpack/test/template/asset_tag_helper_test.rb
+++ b/actionpack/test/template/asset_tag_helper_test.rb
@@ -79,13 +79,17 @@ class AssetTagHelperTest < ActionView::TestCase
JavascriptPathToTag = {
%(javascript_path("xmlhr")) => %(/javascripts/xmlhr.js),
%(javascript_path("super/xmlhr")) => %(/javascripts/super/xmlhr.js),
- %(javascript_path("/super/xmlhr.js")) => %(/super/xmlhr.js)
+ %(javascript_path("/super/xmlhr.js")) => %(/super/xmlhr.js),
+ %(javascript_path("http://www.outside.com/foo.js")) => %(http://www.outside.com/foo.js),
+ %(javascript_path("HTTP://www.outside.com/foo.js")) => %(HTTP://www.outside.com/foo.js)
}
PathToJavascriptToTag = {
%(path_to_javascript("xmlhr")) => %(/javascripts/xmlhr.js),
%(path_to_javascript("super/xmlhr")) => %(/javascripts/super/xmlhr.js),
- %(path_to_javascript("/super/xmlhr.js")) => %(/super/xmlhr.js)
+ %(path_to_javascript("/super/xmlhr.js")) => %(/super/xmlhr.js),
+ %(path_to_javascript("http://www.outside.com/foo.js")) => %(http://www.outside.com/foo.js),
+ %(path_to_javascript("HTTP://www.outside.com/foo.js")) => %(HTTP://www.outside.com/foo.js)
}
JavascriptIncludeToTag = {
@@ -109,14 +113,18 @@ class AssetTagHelperTest < ActionView::TestCase
%(stylesheet_path("bank")) => %(/stylesheets/bank.css),
%(stylesheet_path("bank.css")) => %(/stylesheets/bank.css),
%(stylesheet_path('subdir/subdir')) => %(/stylesheets/subdir/subdir.css),
- %(stylesheet_path('/subdir/subdir.css')) => %(/subdir/subdir.css)
+ %(stylesheet_path('/subdir/subdir.css')) => %(/subdir/subdir.css),
+ %(stylesheet_path("http://www.outside.com/foo.css")) => %(http://www.outside.com/foo.css),
+ %(stylesheet_path("HTTP://www.outside.com/foo.css")) => %(HTTP://www.outside.com/foo.css)
}
PathToStyleToTag = {
%(path_to_stylesheet("style")) => %(/stylesheets/style.css),
%(path_to_stylesheet("style.css")) => %(/stylesheets/style.css),
%(path_to_stylesheet('dir/file')) => %(/stylesheets/dir/file.css),
- %(path_to_stylesheet('/dir/file.rcss')) => %(/dir/file.rcss)
+ %(path_to_stylesheet('/dir/file.rcss')) => %(/dir/file.rcss),
+ %(path_to_stylesheet("http://www.outside.com/foo.css")) => %(http://www.outside.com/foo.css),
+ %(path_to_stylesheet("HTTP://www.outside.com/foo.css")) => %(HTTP://www.outside.com/foo.css)
}
StyleLinkToTag = {
@@ -139,14 +147,18 @@ class AssetTagHelperTest < ActionView::TestCase
%(image_path("xml")) => %(/images/xml),
%(image_path("xml.png")) => %(/images/xml.png),
%(image_path("dir/xml.png")) => %(/images/dir/xml.png),
- %(image_path("/dir/xml.png")) => %(/dir/xml.png)
+ %(image_path("/dir/xml.png")) => %(/dir/xml.png),
+ %(image_path("http://www.outside.com/foo.png")) => %(http://www.outside.com/foo.png),
+ %(image_path("HTTP://www.outside.com/foo.png")) => %(HTTP://www.outside.com/foo.png)
}
PathToImageToTag = {
%(path_to_image("xml")) => %(/images/xml),
%(path_to_image("xml.png")) => %(/images/xml.png),
%(path_to_image("dir/xml.png")) => %(/images/dir/xml.png),
- %(path_to_image("/dir/xml.png")) => %(/dir/xml.png)
+ %(path_to_image("/dir/xml.png")) => %(/dir/xml.png),
+ %(path_to_image("http://www.outside.com/foo.png")) => %(http://www.outside.com/foo.png),
+ %(path_to_image("HTTP://www.outside.com/foo.png")) => %(HTTP://www.outside.com/foo.png)
}
ImageLinkToTag = {
@@ -181,14 +193,18 @@ class AssetTagHelperTest < ActionView::TestCase
%(video_path("xml")) => %(/videos/xml),
%(video_path("xml.ogg")) => %(/videos/xml.ogg),
%(video_path("dir/xml.ogg")) => %(/videos/dir/xml.ogg),
- %(video_path("/dir/xml.ogg")) => %(/dir/xml.ogg)
+ %(video_path("/dir/xml.ogg")) => %(/dir/xml.ogg),
+ %(video_path("http://www.outside.com/foo.ogg")) => %(http://www.outside.com/foo.ogg),
+ %(video_path("HTTP://www.outside.com/foo.ogg")) => %(HTTP://www.outside.com/foo.ogg)
}
PathToVideoToTag = {
%(path_to_video("xml")) => %(/videos/xml),
%(path_to_video("xml.ogg")) => %(/videos/xml.ogg),
%(path_to_video("dir/xml.ogg")) => %(/videos/dir/xml.ogg),
- %(path_to_video("/dir/xml.ogg")) => %(/dir/xml.ogg)
+ %(path_to_video("/dir/xml.ogg")) => %(/dir/xml.ogg),
+ %(path_to_video("http://www.outside.com/foo.ogg")) => %(http://www.outside.com/foo.ogg),
+ %(path_to_video("HTTP://www.outside.com/foo.ogg")) => %(HTTP://www.outside.com/foo.ogg)
}
VideoLinkToTag = {
@@ -211,14 +227,18 @@ class AssetTagHelperTest < ActionView::TestCase
%(audio_path("xml")) => %(/audios/xml),
%(audio_path("xml.wav")) => %(/audios/xml.wav),
%(audio_path("dir/xml.wav")) => %(/audios/dir/xml.wav),
- %(audio_path("/dir/xml.wav")) => %(/dir/xml.wav)
+ %(audio_path("/dir/xml.wav")) => %(/dir/xml.wav),
+ %(audio_path("http://www.outside.com/foo.wav")) => %(http://www.outside.com/foo.wav),
+ %(audio_path("HTTP://www.outside.com/foo.wav")) => %(HTTP://www.outside.com/foo.wav)
}
PathToAudioToTag = {
%(path_to_audio("xml")) => %(/audios/xml),
%(path_to_audio("xml.wav")) => %(/audios/xml.wav),
%(path_to_audio("dir/xml.wav")) => %(/audios/dir/xml.wav),
- %(path_to_audio("/dir/xml.wav")) => %(/dir/xml.wav)
+ %(path_to_audio("/dir/xml.wav")) => %(/dir/xml.wav),
+ %(path_to_audio("http://www.outside.com/foo.wav")) => %(http://www.outside.com/foo.wav),
+ %(path_to_audio("HTTP://www.outside.com/foo.wav")) => %(HTTP://www.outside.com/foo.wav)
}
AudioLinkToTag = {
diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md
index cc1a66c098..c530f7feff 100644
--- a/activerecord/CHANGELOG.md
+++ b/activerecord/CHANGELOG.md
@@ -1,4 +1,8 @@
## unreleased ##
+* Fix mysql2 adapter raises the correct exception when executing a query on a
+ closed connection.
+
+ *Yves Senn*
* Prevent query with NULL foreign key value on CollectionAssociation#ids_reader
for non-persisted records. Fixes bug where Company.new.contract_ids would
diff --git a/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb b/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb
index 524a7d30fc..c690b982a1 100644
--- a/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb
@@ -204,9 +204,11 @@ module ActiveRecord
# Executes the SQL statement in the context of this connection.
def execute(sql, name = nil)
- # make sure we carry over any changes to ActiveRecord::Base.default_timezone that have been
- # made since we established the connection
- @connection.query_options[:database_timezone] = ActiveRecord::Base.default_timezone
+ if @connection
+ # make sure we carry over any changes to ActiveRecord::Base.default_timezone that have been
+ # made since we established the connection
+ @connection.query_options[:database_timezone] = ActiveRecord::Base.default_timezone
+ end
super
end
diff --git a/activerecord/test/cases/disconnected_test.rb b/activerecord/test/cases/disconnected_test.rb
new file mode 100644
index 0000000000..cc2c1f6489
--- /dev/null
+++ b/activerecord/test/cases/disconnected_test.rb
@@ -0,0 +1,26 @@
+require "cases/helper"
+
+class TestRecord < ActiveRecord::Base
+end
+
+class TestDisconnectedAdapter < ActiveRecord::TestCase
+ self.use_transactional_fixtures = false
+
+ def setup
+ @connection = ActiveRecord::Base.connection
+ end
+
+ def teardown
+ spec = ActiveRecord::Base.connection_config
+ ActiveRecord::Base.establish_connection(spec)
+ @connection = nil
+ end
+
+ test "can't execute statements while disconnected" do
+ @connection.execute "SELECT count(*) from products"
+ @connection.disconnect!
+ assert_raises(ActiveRecord::StatementInvalid) do
+ @connection.execute "SELECT count(*) from products"
+ end
+ end
+end
diff --git a/railties/guides/source/caching_with_rails.textile b/railties/guides/source/caching_with_rails.textile
index 376eb74753..444215f0fa 100644
--- a/railties/guides/source/caching_with_rails.textile
+++ b/railties/guides/source/caching_with_rails.textile
@@ -301,8 +301,6 @@ config.cache_store = :memory_store, :size => 64.megabytes
If you're running multiple Ruby on Rails server processes (which is the case if you're using mongrel_cluster or Phusion Passenger), then your Rails server process instances won't be able to share cache data with each other. This cache store is not appropriate for large application deployments, but can work well for small, low traffic sites with only a couple of server processes or for development and test environments.
-This is the default cache store implementation.
-
h4. ActiveSupport::Cache::FileStore
This cache store uses the file system to store entries. The path to the directory where the store files will be stored must be specified when initializing the cache.
@@ -315,6 +313,8 @@ With this cache store, multiple server processes on the same host can share a ca
Note that the cache will grow until the disk is full unless you periodically clear out old entries.
+This is the default cache store if config.cache_store is not defined and tmp/cache is writable.
+
h4. ActiveSupport::Cache::MemCacheStore
This cache store uses Danga's +memcached+ server to provide a centralized cache for your application. Rails uses the bundled +memcache-client+ gem by default. This is currently the most popular cache store for production websites. It can be used to provide a single, shared cache cluster with very a high performance and redundancy.
diff --git a/railties/guides/source/layout.html.erb b/railties/guides/source/layout.html.erb
index 35b6fc7014..4f4cedbd32 100644
--- a/railties/guides/source/layout.html.erb
+++ b/railties/guides/source/layout.html.erb
@@ -81,11 +81,11 @@
</p>
<p>
If you see any typos or factual errors you are confident to
- patch, please clone <%= link_to 'docrails', 'https://github.com/lifo/docrails' %>
- and push the change yourself. That branch of Rails has public write access.
- Commits are still reviewed, but that happens after you've submitted your
- contribution. <%= link_to 'docrails', 'https://github.com/lifo/docrails' %> is
- cross-merged with master periodically.
+ patch, please clone the <%= link_to 'rails', 'https://github.com/rails/rails' %>
+ repository and open a new pull request. You can also ask for commit rights on
+ <%= link_to 'docrails', 'https://github.com/rails/docrails' %> if you plan to submit
+ several patches. Commits are reviewed, but that happens after you've submitted your
+ contribution. This repository is cross-merged with master periodically.
</p>
<p>
You may also find incomplete content, or stuff that is not up to date.