diff options
Diffstat (limited to 'guides/source')
-rw-r--r-- | guides/source/active_storage_overview.md | 22 | ||||
-rw-r--r-- | guides/source/association_basics.md | 8 | ||||
-rw-r--r-- | guides/source/contributing_to_ruby_on_rails.md | 4 |
3 files changed, 19 insertions, 15 deletions
diff --git a/guides/source/active_storage_overview.md b/guides/source/active_storage_overview.md index dbce074388..38323c089f 100644 --- a/guides/source/active_storage_overview.md +++ b/guides/source/active_storage_overview.md @@ -46,7 +46,7 @@ the migration is generated automatically. Declare Active Storage services in `config/storage.yml`. For each service your application uses, provide a name and the requisite configuration. The example -below declares three services named `local`, `test`, and `s3`: +below declares three services named `local`, `test`, and `amazon`: ```yaml local: @@ -57,7 +57,7 @@ test: service: Disk root: <%= Rails.root.join("tmp/storage") %> -s3: +amazon: service: S3 access_key_id: "" secret_access_key: "" @@ -75,12 +75,12 @@ development environment, you would add the following to config.active_storage.service = :local ``` -To use the s3 service in production, you add the following to +To use the Amazon S3 service in production, you add the following to `config/environments/production.rb`: ```ruby -# Store files in S3. -config.active_storage.service = :s3 +# Store files on Amazon S3. +config.active_storage.service = :amazon ``` Continue reading for more information on the built-in service adapters (e.g. @@ -101,7 +101,7 @@ local: Declare an S3 service in `config/storage.yml`: ``` yaml -s3: +amazon: service: S3 access_key_id: "" secret_access_key: "" @@ -204,7 +204,7 @@ Attach Files to a Model The `has_one_attached` macro sets up a one-to-one mapping between records and files. Each record can have one file attached to it. -For example, suppose your application has a User model. If you want each user to +For example, suppose your application has a `User` model. If you want each user to have an avatar, define the `User` model like this: ``` ruby @@ -218,7 +218,7 @@ You can create a user with an avatar: ``` ruby class SignupController < ApplicationController def create - user = Users.create!(user_params) + user = User.create!(user_params) session[:user_id] = user.id redirect_to root_path end @@ -248,7 +248,7 @@ The `has_many_attached` macro sets up a one-to-many relationship between records and files. Each record can have many files attached to it. For example, suppose your application has a `Message` model. If you want each -message to have many images, define the Message model like this: +message to have many images, define the `Message` model like this: ```ruby class Message < ApplicationRecord @@ -332,7 +332,7 @@ To enable variants, add `mini_magick` to your `Gemfile`: gem 'mini_magick' ``` -When the browser hits the variant URL, ActiveStorage will lazy transform the +When the browser hits the variant URL, Active Storage will lazy transform the original blob into the format you specified and redirect to its new service location. @@ -508,7 +508,7 @@ System tests clean up test data by rolling back a transaction. Because destroy is never called on an object, the attached files are never cleaned up. If you want to clear the files, you can do it in an `after_teardown` callback. Doing it here ensures that all connections created during the test are complete and -you won't receive an error from ActiveStorage saying it can't find a file. +you won't receive an error from Active Storage saying it can't find a file. ``` ruby class ApplicationSystemTestCase < ActionDispatch::SystemTestCase diff --git a/guides/source/association_basics.md b/guides/source/association_basics.md index 9616647f15..b5e236b790 100644 --- a/guides/source/association_basics.md +++ b/guides/source/association_basics.md @@ -1561,7 +1561,8 @@ The `collection.size` method returns the number of objects in the collection. ##### `collection.find(...)` -The `collection.find` method finds objects within the collection. It uses the same syntax and options as `ActiveRecord::Base.find`. +The `collection.find` method finds objects within the collection. It uses the same syntax and options as +[`ActiveRecord::Base.find`](http://api.rubyonrails.org/classes/ActiveRecord/FinderMethods.html#method-i-find). ```ruby @available_book = @author.books.find(1) @@ -2091,7 +2092,8 @@ The `collection.size` method returns the number of objects in the collection. ##### `collection.find(...)` -The `collection.find` method finds objects within the collection. It uses the same syntax and options as `ActiveRecord::Base.find`. It also adds the additional condition that the object must be in the collection. +The `collection.find` method finds objects within the collection. It uses the same syntax and options as +[`ActiveRecord::Base.find`](http://api.rubyonrails.org/classes/ActiveRecord/FinderMethods.html#method-i-find). ```ruby @assembly = @part.assemblies.find(1) @@ -2099,7 +2101,7 @@ The `collection.find` method finds objects within the collection. It uses the sa ##### `collection.where(...)` -The `collection.where` method finds objects within the collection based on the conditions supplied but the objects are loaded lazily meaning that the database is queried only when the object(s) are accessed. It also adds the additional condition that the object must be in the collection. +The `collection.where` method finds objects within the collection based on the conditions supplied but the objects are loaded lazily meaning that the database is queried only when the object(s) are accessed. ```ruby @new_assemblies = @part.assemblies.where("created_at > ?", 2.days.ago) diff --git a/guides/source/contributing_to_ruby_on_rails.md b/guides/source/contributing_to_ruby_on_rails.md index 7424818757..967c992c05 100644 --- a/guides/source/contributing_to_ruby_on_rails.md +++ b/guides/source/contributing_to_ruby_on_rails.md @@ -84,7 +84,9 @@ discussions new features require. Helping to Resolve Existing Issues ---------------------------------- -As a next step beyond reporting issues, you can help the core team resolve existing issues. If you check the [issues list](https://github.com/rails/rails/issues) in GitHub Issues, you'll find lots of issues already requiring attention. What can you do for these? Quite a bit, actually: +As a next step beyond reporting issues, you can help the core team resolve existing ones by providing feedback about them. If you are new to Rails core development, that might be a great way to walk your first steps, you'll get familiar with the code base and the processes. + +If you check the [issues list](https://github.com/rails/rails/issues) in GitHub Issues, you'll find lots of issues already requiring attention. What can you do for these? Quite a bit, actually: ### Verifying Bug Reports |