aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Gemfile3
-rw-r--r--actionpack/lib/abstract_controller/url_for.rb2
-rw-r--r--actionview/CHANGELOG.md10
-rw-r--r--actionview/lib/action_view/helpers/asset_url_helper.rb12
-rw-r--r--actionview/test/template/asset_tag_helper_test.rb15
-rw-r--r--activemodel/CHANGELOG.md2
-rw-r--r--activerecord/CHANGELOG.md10
-rw-r--r--activerecord/Rakefile2
-rw-r--r--activerecord/test/config.example.yml30
-rw-r--r--activesupport/CHANGELOG.md2
-rw-r--r--guides/source/asset_pipeline.md8
-rw-r--r--guides/source/migrations.md5
12 files changed, 58 insertions, 43 deletions
diff --git a/Gemfile b/Gemfile
index 4108c7e179..43efc925d9 100644
--- a/Gemfile
+++ b/Gemfile
@@ -39,6 +39,9 @@ local_gemfile = File.dirname(__FILE__) + "/.Gemfile"
instance_eval File.read local_gemfile if File.exist? local_gemfile
group :test do
+ # FIX: Our test suite isn't ready to run in random order yet
+ gem 'minitest', '< 5.3.4'
+
platforms :mri_19 do
gem 'ruby-prof', '~> 0.11.2'
end
diff --git a/actionpack/lib/abstract_controller/url_for.rb b/actionpack/lib/abstract_controller/url_for.rb
index 4a95e1f276..72d07b0927 100644
--- a/actionpack/lib/abstract_controller/url_for.rb
+++ b/actionpack/lib/abstract_controller/url_for.rb
@@ -11,7 +11,7 @@ module AbstractController
def _routes
raise "In order to use #url_for, you must include routing helpers explicitly. " \
- "For instance, `include Rails.application.routes.url_helpers"
+ "For instance, `include Rails.application.routes.url_helpers`."
end
module ClassMethods
diff --git a/actionview/CHANGELOG.md b/actionview/CHANGELOG.md
index e39fa68b26..147e5b47db 100644
--- a/actionview/CHANGELOG.md
+++ b/actionview/CHANGELOG.md
@@ -1,3 +1,8 @@
+* Allow custom `:host` option to be passed to `asset_url` helper that
+ overwrites `config.action_controller.asset_host` for particular asset.
+
+ *Hubert Łępicki*
+
* Deprecate `AbstractController::Base.parent_prefixes`.
Override `AbstractController::Base.local_prefixes` when you want to change
where to find views.
@@ -26,9 +31,11 @@
* Change `asset_path` to use File.join to create proper paths:
+ Before:
+
https://some.host.com//assets/some.js
- becomes
+ After:
https://some.host.com/assets/some.js
@@ -93,5 +100,4 @@
*Piotr Chmolowski, Łukasz Strzałkowski*
-
Please check [4-1-stable](https://github.com/rails/rails/blob/4-1-stable/actionview/CHANGELOG.md) for previous changes.
diff --git a/actionview/lib/action_view/helpers/asset_url_helper.rb b/actionview/lib/action_view/helpers/asset_url_helper.rb
index 41997a85b3..ae684af87b 100644
--- a/actionview/lib/action_view/helpers/asset_url_helper.rb
+++ b/actionview/lib/action_view/helpers/asset_url_helper.rb
@@ -147,7 +147,14 @@ module ActionView
# Computes the full URL to an asset in the public directory. This
# will use +asset_path+ internally, so most of their behaviors
- # will be the same.
+ # will be the same. If :host options is set, it overwrites global
+ # +config.action_controller.asset_host+ setting.
+ #
+ # All other options provided are forwarded to +asset_path+ call.
+ #
+ # asset_url "application.js" # => http://example.com/application.js
+ # asset_url "application.js", host: "http://cdn.example.com" # => http://cdn.example.com/javascripts/application.js
+ #
def asset_url(source, options = {})
path_to_asset(source, options.merge(:protocol => :request))
end
@@ -191,7 +198,8 @@ module ActionView
# (proc or otherwise).
def compute_asset_host(source = "", options = {})
request = self.request if respond_to?(:request)
- host = config.asset_host if defined? config.asset_host
+ host = options[:host]
+ host ||= config.asset_host if defined? config.asset_host
host ||= request.base_url if request && options[:protocol] == :request
if host.respond_to?(:call)
diff --git a/actionview/test/template/asset_tag_helper_test.rb b/actionview/test/template/asset_tag_helper_test.rb
index 18e4277d7a..343681b5a9 100644
--- a/actionview/test/template/asset_tag_helper_test.rb
+++ b/actionview/test/template/asset_tag_helper_test.rb
@@ -596,6 +596,10 @@ class AssetTagHelperNonVhostTest < ActionView::TestCase
assert_equal "gopher://www.example.com", compute_asset_host("foo", :protocol => :request)
end
+ def test_should_return_custom_host_if_passed_in_options
+ assert_equal "http://custom.example.com", compute_asset_host("foo", :host => "http://custom.example.com")
+ end
+
def test_should_ignore_relative_root_path_on_complete_url
assert_dom_equal(%(http://www.example.com/images/xml.png), image_path("http://www.example.com/images/xml.png"))
end
@@ -759,4 +763,15 @@ class AssetUrlHelperEmptyModuleTest < ActionView::TestCase
assert @module.config.asset_host
assert_equal "http://www.example.com/foo", @module.asset_url("foo")
end
+
+ def test_asset_url_with_custom_asset_host
+ @module.instance_eval do
+ def config
+ Struct.new(:asset_host).new("http://www.example.com")
+ end
+ end
+
+ assert @module.config.asset_host
+ assert_equal "http://custom.example.com/foo", @module.asset_url("foo", :host => "http://custom.example.com")
+ end
end
diff --git a/activemodel/CHANGELOG.md b/activemodel/CHANGELOG.md
index 68cc874ca3..b94558b65c 100644
--- a/activemodel/CHANGELOG.md
+++ b/activemodel/CHANGELOG.md
@@ -1,4 +1,4 @@
-* Add plural and singular form for length validator's default messages
+* Add plural and singular form for length validator's default messages.
*Abd ar-Rahman Hamid*
diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md
index 3474a983e1..5647204859 100644
--- a/activerecord/CHANGELOG.md
+++ b/activerecord/CHANGELOG.md
@@ -46,13 +46,13 @@
* Fix `PostgreSQLAdapter::OID::Float#type_cast` to convert Infinity and
NaN PostgreSQL values into a native Ruby `Float::INFINITY` and `Float::NAN`
- Example:
+ Before:
- # Before
Point.create(value: 1.0/0)
Point.last.value # => 0.0
- # After
+ After:
+
Point.create(value: 1.0/0)
Point.last.value # => Infinity
@@ -78,7 +78,7 @@
HABTM should fall back to using the normal CollectionAssociation's size
calculation if the collection is not cached or loaded.
- Fixes #14913 and #14914.
+ Fixes #14913, #14914.
*Fred Wu*
@@ -280,7 +280,7 @@
* Auto-generate stable fixture UUIDs on PostgreSQL.
- Fixes: #11524
+ Fixes #11524.
*Roderick van Domburg*
diff --git a/activerecord/Rakefile b/activerecord/Rakefile
index 84856774f2..01ca4c82f2 100644
--- a/activerecord/Rakefile
+++ b/activerecord/Rakefile
@@ -45,7 +45,7 @@ namespace :db do
task drop: ['mysql:drop_databases', 'postgresql:drop_databases']
end
-%w( mysql mysql2 postgresql sqlite3 sqlite3_mem firebird db2 oracle sybase openbase frontbase jdbcmysql jdbcpostgresql jdbcsqlite3 jdbcderby jdbch2 jdbchsqldb ).each do |adapter|
+%w( mysql mysql2 postgresql sqlite3 sqlite3_mem db2 oracle jdbcmysql jdbcpostgresql jdbcsqlite3 jdbcderby jdbch2 jdbchsqldb ).each do |adapter|
Rake::TestTask.new("test_#{adapter}") { |t|
adapter_short = adapter == 'db2' ? adapter : adapter[/^[a-z0-9]+/]
t.libs << 'test'
diff --git a/activerecord/test/config.example.yml b/activerecord/test/config.example.yml
index 479b8c050d..a54914c372 100644
--- a/activerecord/test/config.example.yml
+++ b/activerecord/test/config.example.yml
@@ -51,28 +51,6 @@ connections:
password: arunit
database: arunit2
- firebird:
- arunit:
- host: localhost
- username: rails
- password: rails
- charset: UTF8
- arunit2:
- host: localhost
- username: rails
- password: rails
- charset: UTF8
-
- frontbase:
- arunit:
- host: localhost
- username: rails
- session_name: unittest-<%= $$ %>
- arunit2:
- host: localhost
- username: rails
- session_name: unittest-<%= $$ %>
-
mysql:
arunit:
username: rails
@@ -130,11 +108,3 @@ connections:
arunit2:
adapter: sqlite3
database: ':memory:'
-
- sybase:
- arunit:
- host: database_ASE
- username: sa
- arunit2:
- host: database_ASE
- username: sa
diff --git a/activesupport/CHANGELOG.md b/activesupport/CHANGELOG.md
index 77224a208a..866a5a958d 100644
--- a/activesupport/CHANGELOG.md
+++ b/activesupport/CHANGELOG.md
@@ -7,7 +7,7 @@
convert a value that is an `ActiveSupport::SafeBuffer` introduced
in 2da9d67.
- For more info see #15064.
+ See #15064.
*Mark J. Titorenko*
diff --git a/guides/source/asset_pipeline.md b/guides/source/asset_pipeline.md
index 52fc9726d9..950cfdca29 100644
--- a/guides/source/asset_pipeline.md
+++ b/guides/source/asset_pipeline.md
@@ -913,6 +913,14 @@ that it plays nicely with the pipeline. You may find quirks related to your
specific set up, you may not. The defaults nginx uses, for example, should give
you no problems when used as an HTTP cache.
+If you want to serve only some assets from your CDN, you can use custom
+`:host` option of `asset_url` helper, which overwrites value set in
+`config.action_controller.asset_host`.
+
+```ruby
+asset_url 'image.png', :host => 'http://cdn.example.com'
+```
+
Customizing the Pipeline
------------------------
diff --git a/guides/source/migrations.md b/guides/source/migrations.md
index c61ccfe94a..fe1a6a4697 100644
--- a/guides/source/migrations.md
+++ b/guides/source/migrations.md
@@ -902,6 +902,11 @@ schema into a RDBMS other than the one used to create it.
Because schema dumps are the authoritative source for your database schema, it
is strongly recommended that you check them into source control.
+`db/schema.rb` contains the current version number of the database. This
+ensures conflicts are going to happen in the case of a merge where both
+branches touched the schema. When that happens, solve conflicts manually,
+keeping the highest version number of the two.
+
Active Record and Referential Integrity
---------------------------------------