aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--activestorage/lib/active_storage/service/disk_service.rb2
-rw-r--r--activestorage/test/dummy/config/storage.yml1
-rw-r--r--activestorage/test/service/configurator_test.rb2
-rw-r--r--activestorage/test/service/disk_service_test.rb2
-rw-r--r--activestorage/test/service/mirror_service_test.rb5
-rw-r--r--activestorage/test/test_helper.rb2
-rw-r--r--guides/source/active_storage_overview.md12
-rw-r--r--guides/source/layouts_and_rendering.md2
-rw-r--r--railties/lib/rails/generators/rails/app/templates/config/storage.yml.tt2
9 files changed, 16 insertions, 14 deletions
diff --git a/activestorage/lib/active_storage/service/disk_service.rb b/activestorage/lib/active_storage/service/disk_service.rb
index 27769db584..d17eea9046 100644
--- a/activestorage/lib/active_storage/service/disk_service.rb
+++ b/activestorage/lib/active_storage/service/disk_service.rb
@@ -11,7 +11,7 @@ module ActiveStorage
class Service::DiskService < Service
attr_reader :root, :host
- def initialize(root:, host:)
+ def initialize(root:, host: "http://localhost:3000")
@root, @host = root, host
end
diff --git a/activestorage/test/dummy/config/storage.yml b/activestorage/test/dummy/config/storage.yml
index 2acc78dc4c..2c6762e0d6 100644
--- a/activestorage/test/dummy/config/storage.yml
+++ b/activestorage/test/dummy/config/storage.yml
@@ -1,4 +1,3 @@
local:
service: Disk
root: <%= Rails.root.join("storage") %>
- host: http://localhost:3000
diff --git a/activestorage/test/service/configurator_test.rb b/activestorage/test/service/configurator_test.rb
index 0a79b37aa4..fe8a637ad0 100644
--- a/activestorage/test/service/configurator_test.rb
+++ b/activestorage/test/service/configurator_test.rb
@@ -4,7 +4,7 @@ require "service/shared_service_tests"
class ActiveStorage::Service::ConfiguratorTest < ActiveSupport::TestCase
test "builds correct service instance based on service name" do
- service = ActiveStorage::Service::Configurator.build(:foo, foo: { service: "Disk", root: "path", host: "http://localhost:3000" })
+ service = ActiveStorage::Service::Configurator.build(:foo, foo: { service: "Disk", root: "path" })
assert_instance_of ActiveStorage::Service::DiskService, service
assert_equal "path", service.root
diff --git a/activestorage/test/service/disk_service_test.rb b/activestorage/test/service/disk_service_test.rb
index f0171f8999..4a6361b920 100644
--- a/activestorage/test/service/disk_service_test.rb
+++ b/activestorage/test/service/disk_service_test.rb
@@ -3,7 +3,7 @@
require "service/shared_service_tests"
class ActiveStorage::Service::DiskServiceTest < ActiveSupport::TestCase
- SERVICE = ActiveStorage::Service::DiskService.new(root: File.join(Dir.tmpdir, "active_storage"), host: "http://localhost:3000")
+ SERVICE = ActiveStorage::Service::DiskService.new(root: File.join(Dir.tmpdir, "active_storage"))
include ActiveStorage::Service::SharedServiceTests
diff --git a/activestorage/test/service/mirror_service_test.rb b/activestorage/test/service/mirror_service_test.rb
index 6b601f3b2b..08efb095bc 100644
--- a/activestorage/test/service/mirror_service_test.rb
+++ b/activestorage/test/service/mirror_service_test.rb
@@ -6,13 +6,12 @@ class ActiveStorage::Service::MirrorServiceTest < ActiveSupport::TestCase
mirror_config = (1..3).map do |i|
[ "mirror_#{i}",
service: "Disk",
- root: Dir.mktmpdir("active_storage_tests_mirror_#{i}"),
- host: "http://localhost:3000" ]
+ root: Dir.mktmpdir("active_storage_tests_mirror_#{i}") ]
end.to_h
config = mirror_config.merge \
mirror: { service: "Mirror", primary: "primary", mirrors: mirror_config.keys },
- primary: { service: "Disk", root: Dir.mktmpdir("active_storage_tests_primary"), host: "http://localhost:3000" }
+ primary: { service: "Disk", root: Dir.mktmpdir("active_storage_tests_primary") }
SERVICE = ActiveStorage::Service.configure :mirror, config
diff --git a/activestorage/test/test_helper.rb b/activestorage/test/test_helper.rb
index 51f8ebad18..98fa44a604 100644
--- a/activestorage/test/test_helper.rb
+++ b/activestorage/test/test_helper.rb
@@ -34,7 +34,7 @@ rescue Errno::ENOENT
end
require "tmpdir"
-ActiveStorage::Blob.service = ActiveStorage::Service::DiskService.new(root: Dir.mktmpdir("active_storage_tests"), host: "http://localhost:3000")
+ActiveStorage::Blob.service = ActiveStorage::Service::DiskService.new(root: Dir.mktmpdir("active_storage_tests"))
ActiveStorage.logger = ActiveSupport::Logger.new(nil)
ActiveStorage.verifier = ActiveSupport::MessageVerifier.new("Testing")
diff --git a/guides/source/active_storage_overview.md b/guides/source/active_storage_overview.md
index c5bd09ead6..d9f5aa8385 100644
--- a/guides/source/active_storage_overview.md
+++ b/guides/source/active_storage_overview.md
@@ -49,12 +49,10 @@ below declares three services named `local`, `test`, and `amazon`:
local:
service: Disk
root: <%= Rails.root.join("storage") %>
- host: http://localhost:3000
test:
service: Disk
root: <%= Rails.root.join("tmp/storage") %>
- host: http://localhost:3000
amazon:
service: S3
@@ -93,7 +91,15 @@ Declare a Disk service in `config/storage.yml`:
local:
service: Disk
root: <%= Rails.root.join("storage") %>
- host: http://localhost:3000
+```
+
+Optionally specify a host for generating URLs (the default is `http://localhost:3000`):
+
+```yaml
+local:
+ service: Disk
+ root: <%= Rails.root.join("storage") %>
+ host: http://myapp.test
```
### Amazon S3 Service
diff --git a/guides/source/layouts_and_rendering.md b/guides/source/layouts_and_rendering.md
index 4d79b2db89..15345c94b7 100644
--- a/guides/source/layouts_and_rendering.md
+++ b/guides/source/layouts_and_rendering.md
@@ -97,7 +97,7 @@ If we want to display the properties of all the books in our view, we can do so
<%= link_to "New book", new_book_path %>
```
-NOTE: The actual rendering is done by subclasses of `ActionView::TemplateHandlers`. This guide does not dig into that process, but it's important to know that the file extension on your view controls the choice of template handler. Beginning with Rails 2, the standard extensions are `.erb` for ERB (HTML with embedded Ruby), and `.builder` for Builder (XML generator).
+NOTE: The actual rendering is done by nested classes of the module [`ActionView::Template::Handlers`](http://api.rubyonrails.org/classes/ActionView/Template/Handlers.html). This guide does not dig into that process, but it's important to know that the file extension on your view controls the choice of template handler.
### Using `render`
diff --git a/railties/lib/rails/generators/rails/app/templates/config/storage.yml.tt b/railties/lib/rails/generators/rails/app/templates/config/storage.yml.tt
index fac165a24d..1c0cde0b09 100644
--- a/railties/lib/rails/generators/rails/app/templates/config/storage.yml.tt
+++ b/railties/lib/rails/generators/rails/app/templates/config/storage.yml.tt
@@ -1,12 +1,10 @@
test:
service: Disk
root: <%%= Rails.root.join("tmp/storage") %>
- host: http://localhost:3000
local:
service: Disk
root: <%%= Rails.root.join("storage") %>
- host: http://localhost:3000
# Use rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
# amazon: