Skip to content

Commit

Permalink
fix some grammar errors on guide doc.
Browse files Browse the repository at this point in the history
  • Loading branch information
nursoltan-s committed Oct 24, 2019
1 parent d775176 commit 3ffc363
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions guides/source/active_record_querying.md
Expand Up @@ -1219,7 +1219,7 @@ clients.each do |client|
end
```

This code looks fine at the first sight. But the problem lies within the total number of queries executed. The above code executes 1 (to find 10 clients) + 10 (one per each client to load the address) = **11** queries in total.
This code looks fine at first sight. But the problem lies within the total number of queries executed. The above code executes 1 (to find 10 clients) + 10 (one per each client to load the address) = **11** queries in total.

**Solution to N + 1 queries problem**

Expand Down Expand Up @@ -1453,7 +1453,7 @@ User.active.inactive
# SELECT "users".* FROM "users" WHERE "users"."state" = 'active' AND "users"."state" = 'inactive'
```

We can mix and match `scope` and `where` conditions and the final sql
We can mix and match `scope` and `where` conditions and the final SQL
will have all conditions joined with `AND`.

```ruby
Expand Down Expand Up @@ -1750,7 +1750,7 @@ Client.connection.select_all("SELECT first_name, created_at FROM clients WHERE i

### `pluck`

`pluck` can be used to query single or multiple columns from the underlying table of a model. It accepts a list of column names as argument and returns an array of values of the specified columns with the corresponding data type.
`pluck` can be used to query single or multiple columns from the underlying table of a model. It accepts a list of column names as an argument and returns an array of values of the specified columns with the corresponding data type.

```ruby
Client.where(active: true).pluck(:id)
Expand Down
2 changes: 1 addition & 1 deletion guides/source/active_record_validations.md
Expand Up @@ -64,7 +64,7 @@ controller-level validations. Here's a summary of the pros and cons:
* Controller-level validations can be tempting to use, but often become
unwieldy and difficult to test and maintain. Whenever possible, it's a good
idea to keep your controllers skinny, as it will make your application a
pleasure to work with in the long run.
pleasure to work within the long run.

Choose these in certain, specific cases. It's the opinion of the Rails team
that model-level validations are the most appropriate in most circumstances.
Expand Down
2 changes: 1 addition & 1 deletion guides/source/autoloading_and_reloading_constants.md
Expand Up @@ -171,7 +171,7 @@ Similarly, in the Rails console, if you have a user instance and reload:
> reload!
```

the `user` object is instance of a stale class object. Ruby gives you a new class if you evaluate `User` again, but does not update the class `user` is instance of.
the `user` object is an instance of a stale class object. Ruby gives you a new class if you evaluate `User` again, but does not update the class `user` is an instance of.

Another use case of this gotcha is subclassing reloadable classes in a place that is not reloaded:

Expand Down

0 comments on commit 3ffc363

Please sign in to comment.