提交 fc6336d1 编写于 作者: K Katie Oldaker

Punctuation, capitalization, grammar fixes in rails guides

上级 38db4e2c
......@@ -5,6 +5,10 @@ This guide should provide you with all you need to get started in sending and re
After reading this guide, you will know:
* How to send and receive email within a Rails application.
* How to generate and edit an Action Mailer class and mailer view.
* How to configure Action Mailer for your environment.
* How to test your Action Mailer classes.
--------------------------------------------------------------------------------
Introduction
......
......@@ -1190,7 +1190,7 @@ class Client < ActiveRecord::Base
end
```
### Removing all scoping
### Removing All Scoping
If we wish to remove scoping for any reason we can use the `unscoped` method. This is
especially useful if a `default_scope` is specified in the model and should not be
......@@ -1224,7 +1224,7 @@ If you want to find both by name and locked, you can chain these finders togethe
WARNING: Up to and including Rails 3.1, when the number of arguments passed to a dynamic finder method is lesser than the number of fields, say `Client.find_by_name_and_locked("Ryan")`, the behavior is to pass `nil` as the missing argument. This is **unintentional** and this behavior has been changed in Rails 3.2 to throw an `ArgumentError`.
Find or build a new object
Find or Build a New Object
--------------------------
It's common that you need to find a record or create it if it doesn't exist. You can do that with the `find_or_create_by` and `find_or_create_by!` methods.
......
......@@ -779,7 +779,7 @@ class Account < ActiveRecord::Base
end
```
### Grouping conditional validations
### Grouping Conditional validations
Sometimes it is useful to have multiple validations use one condition, it can
be easily achieved using `with_options`.
......@@ -796,7 +796,7 @@ end
All validations inside of `with_options` block will have automatically passed
the condition `if: :is_admin?`
### Combining validation conditions
### Combining Validation Conditions
On the other hand, when multiple conditions define whether or not a validation
should happen, an `Array` can be used. Moreover, you can apply both `:if` and
......
......@@ -131,7 +131,7 @@ Pipeline assets can be placed inside an application in one of three locations: `
* `vendor/assets` is for assets that are owned by outside entities, such as code for JavaScript plugins and CSS frameworks.
#### Search paths
#### Search Paths
When a file is referenced from a manifest or a helper, Sprockets searches the three default asset locations for it.
......@@ -179,7 +179,7 @@ Paths are traversed in the order that they occur in the search path. By default,
It is important to note that files you want to reference outside a manifest must be added to the precompile array or they will not be available in the production environment.
#### Using index files
#### Using Index Files
Sprockets uses files named `index` (with the relevant extensions) for a special purpose.
......@@ -354,7 +354,7 @@ would generate this HTML:
The `body` param is required by Sprockets.
### Turning Debugging off
### Turning Debugging Off
You can turn off debug mode by updating `config/environments/development.rb` to include:
......@@ -479,7 +479,7 @@ The default location for the manifest is the root of the location specified in `
NOTE: If there are missing precompiled files in production you will get an `Sprockets::Helpers::RailsHelper::AssetPaths::AssetNotPrecompiledError` exception indicating the name of the missing file(s).
#### Far-future Expires header
#### Far-future Expires Header
Precompiled assets exist on the filesystem and are served directly by your web server. They do not have far-future headers by default, so to get the benefit of fingerprinting you'll have to update your server configuration to add them.
......@@ -509,7 +509,7 @@ location ~ ^/assets/ {
}
```
#### GZip compression
#### GZip Compression
When files are precompiled, Sprockets also creates a [gzipped](http://en.wikipedia.org/wiki/Gzip) (.gz) version of your assets. Web servers are typically configured to use a moderate compression ratio as a compromise, but since precompilation happens once, Sprockets uses the maximum compression ratio, thus reducing the size of the data transfer to the minimum. On the other hand, web servers can be configured to serve compressed content directly from disk, rather than deflating non-compressed files themselves.
......
......@@ -452,7 +452,7 @@ class CreateAssemblyPartJoinTable < ActiveRecord::Migration
end
```
We pass `id: false` to `create_table` because that table does not represent a model. That's required for the association to work properly. If you observe any strange behavior in a `has_and_belongs_to_many` association like mangled models IDs, or exceptions about conflicting IDs chances are you forgot that bit.
We pass `id: false` to `create_table` because that table does not represent a model. That's required for the association to work properly. If you observe any strange behavior in a `has_and_belongs_to_many` association like mangled models IDs, or exceptions about conflicting IDs, chances are you forgot that bit.
### Controlling Association Scope
......
......@@ -91,7 +91,7 @@ You can invoke `test_jdbcmysql`, `test_jdbcsqlite3` or `test_jdbcpostgresql` als
The test suite runs with warnings enabled. Ideally, Ruby on Rails should issue no warnings, but there may be a few, as well as some from third-party libraries. Please ignore (or fix!) them, if any, and submit patches that do not issue new warnings.
As of this writing (December, 2010) they are specially noisy with Ruby 1.9. If you are sure about what you are doing and would like to have a more clear output, there's a way to override the flag:
As of this writing (December, 2010) they are especially noisy with Ruby 1.9. If you are sure about what you are doing and would like to have a more clear output, there's a way to override the flag:
```bash
$ RUBYOPT=-W0 bundle exec rake test
......@@ -205,7 +205,7 @@ TIP: Changes that are cosmetic in nature and do not add anything substantial to
### Follow the Coding Conventions
Rails follows a simple set of coding style conventions.
Rails follows a simple set of coding style conventions:
* Two spaces, no tabs (for indentation).
* No trailing whitespace. Blank lines should not have any spaces.
......
......@@ -334,7 +334,7 @@ end
removes the `description` and `name` columns, creates a `part_number` string
column and adds an index on it. Finally it renames the `upccode` column.
### When Helpers Aren't Enough
### When Helpers aren't Enough
If the helpers provided by Active Record aren't enough you can use the `execute`
method to execute arbitrary SQL:
......@@ -585,8 +585,8 @@ Occasionally you will make a mistake when writing a migration. If you have
already run the migration then you cannot just edit the migration and run the
migration again: Rails thinks it has already run the migration and so will do
nothing when you run `rake db:migrate`. You must rollback the migration (for
example with `rake db:rollback`), edit your migration and then run `rake
db:migrate` to run the corrected version.
example with `rake db:rollback`), edit your migration and then run
`rake db:migrate` to run the corrected version.
In general, editing existing migrations is not a good idea. You will be
creating extra work for yourself and your co-workers and cause major headaches
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册