Skip to content

Commit c6fd1e1

Browse files
committed
Markdown format fixes (en).
1 parent c5f2b41 commit c6fd1e1

11 files changed

+28
-32
lines changed

source/active_record_callbacks.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ After reading this guide, you will know:
1515
The Object Life Cycle
1616
---------------------
1717

18-
During the normal operation of a Rails application, objects may be created, updated, and destroyed. Active Record provides hooks into this <em>object life cycle</em> so that you can control your application and its data.
18+
During the normal operation of a Rails application, objects may be created, updated, and destroyed. Active Record provides hooks into this *object life cycle* so that you can control your application and its data.
1919

2020
Callbacks allow you to trigger logic before or after an alteration of an object's state.
2121

source/active_support_core_extensions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1165,9 +1165,9 @@ Inserting data into HTML templates needs extra care. For example, you can't just
11651165

11661166
#### Safe Strings
11671167

1168-
Active Support has the concept of <i>(html) safe</i> strings. A safe string is one that is marked as being insertable into HTML as is. It is trusted, no matter whether it has been escaped or not.
1168+
Active Support has the concept of _(html) safe_ strings. A safe string is one that is marked as being insertable into HTML as is. It is trusted, no matter whether it has been escaped or not.
11691169

1170-
Strings are considered to be <i>unsafe</i> by default:
1170+
Strings are considered to be _unsafe_ by default:
11711171

11721172
```ruby
11731173
"".html_safe? # => false

source/api_documentation_guidelines.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ used. Instead of:
7979
English
8080
-------
8181

82-
Please use American English (<em>color</em>, <em>center</em>, <em>modularize</em>, etc). See [a list of American and British English spelling differences here](http://en.wikipedia.org/wiki/American_and_British_English_spelling_differences).
82+
Please use American English (*color*, *center*, *modularize*, etc). See [a list of American and British English spelling differences here](http://en.wikipedia.org/wiki/American_and_British_English_spelling_differences).
8383

8484
Example Code
8585
------------

source/asset_pipeline.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,19 +124,19 @@ with a built-in helper. In the source the generated code looked like this:
124124
The query string strategy has several disadvantages:
125125

126126
1. **Not all caches will reliably cache content where the filename only differs by
127-
query parameters**<br>
127+
query parameters**
128128
[Steve Souders recommends](http://www.stevesouders.com/blog/2008/08/23/revving-filenames-dont-use-querystring/),
129129
"...avoiding a querystring for cacheable resources". He found that in this
130130
case 5-20% of requests will not be cached. Query strings in particular do not
131131
work at all with some CDNs for cache invalidation.
132132

133-
2. **The file name can change between nodes in multi-server environments.**<br>
133+
2. **The file name can change between nodes in multi-server environments.**
134134
The default query string in Rails 2.x is based on the modification time of
135135
the files. When assets are deployed to a cluster, there is no guarantee that the
136136
timestamps will be the same, resulting in different values being used depending
137137
on which server handles the request.
138138

139-
3. **Too much cache invalidation**<br>
139+
3. **Too much cache invalidation**
140140
When static assets are deployed with each new release of code, the mtime
141141
(time of last modification) of _all_ these files changes, forcing all remote
142142
clients to fetch them again, even when the content of those assets has not changed.

source/association_basics.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1131,7 +1131,7 @@ The `has_one` association supports these options:
11311131

11321132
##### `:as`
11331133

1134-
Setting the `:as` option indicates that this is a polymorphic association. Polymorphic associations were discussed in detail <a href="#polymorphic-associations">earlier in this guide</a>.
1134+
Setting the `:as` option indicates that this is a polymorphic association. Polymorphic associations were discussed in detail [earlier in this guide](#polymorphic-associations).
11351135

11361136
##### `:autosave`
11371137

@@ -1203,7 +1203,7 @@ The `:source_type` option specifies the source association type for a `has_one :
12031203

12041204
##### `:through`
12051205

1206-
The `:through` option specifies a join model through which to perform the query. `has_one :through` associations were discussed in detail <a href="#the-has-one-through-association">earlier in this guide</a>.
1206+
The `:through` option specifies a join model through which to perform the query. `has_one :through` associations were discussed in detail [earlier in this guide](#the-has-one-through-association).
12071207

12081208
##### `:validate`
12091209

@@ -1497,7 +1497,7 @@ The `has_many` association supports these options:
14971497

14981498
##### `:as`
14991499

1500-
Setting the `:as` option indicates that this is a polymorphic association, as discussed <a href="#polymorphic-associations">earlier in this guide</a>.
1500+
Setting the `:as` option indicates that this is a polymorphic association, as discussed [earlier in this guide](#polymorphic-associations).
15011501

15021502
##### `:autosave`
15031503

@@ -1579,7 +1579,7 @@ The `:source_type` option specifies the source association type for a `has_many
15791579

15801580
##### `:through`
15811581

1582-
The `:through` option specifies a join model through which to perform the query. `has_many :through` associations provide a way to implement many-to-many relationships, as discussed <a href="#the-has-many-through-association">earlier in this guide</a>.
1582+
The `:through` option specifies a join model through which to perform the query. `has_many :through` associations provide a way to implement many-to-many relationships, as discussed [earlier in this guide](#the-has-many-through-association).
15831583

15841584
##### `:validate`
15851585

@@ -1632,7 +1632,7 @@ If you use a hash-style `where` option, then record creation via this associatio
16321632

16331633
##### `extending`
16341634

1635-
The `extending` method specifies a named module to extend the association proxy. Association extensions are discussed in detail <a href="#association-extensions">later in this guide</a>.
1635+
The `extending` method specifies a named module to extend the association proxy. Association extensions are discussed in detail [later in this guide](#association-extensions).
16361636

16371637
##### `group`
16381638

@@ -2082,7 +2082,7 @@ If you use a hash-style `where`, then record creation via this association will
20822082

20832083
##### `extending`
20842084

2085-
The `extending` method specifies a named module to extend the association proxy. Association extensions are discussed in detail <a href="#association-extensions">later in this guide</a>.
2085+
The `extending` method specifies a named module to extend the association proxy. Association extensions are discussed in detail [later in this guide](#association-extensions).
20862086

20872087
##### `group`
20882088

source/caching_with_rails.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ end
185185
Cache Stores
186186
------------
187187

188-
Rails provides different stores for the cached data created by <b>action</b> and <b>fragment</b> caches.
188+
Rails provides different stores for the cached data created by **action** and **fragment** caches.
189189

190190
TIP: Page caches are always stored on disk.
191191

source/contributing_to_ruby_on_rails.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,7 @@ After applying their branch, test it out! Here are some things to think about:
109109

110110
Once you're happy that the pull request contains a good change, comment on the GitHub issue indicating your approval. Your comment should indicate that you like the change and what you like about it. Something like:
111111

112-
<blockquote>
113-
I like the way you've restructured that code in generate_finder_sql - much nicer. The tests look good too.
114-
</blockquote>
112+
>I like the way you've restructured that code in generate_finder_sql - much nicer. The tests look good too.
115113
116114
If your comment simply says "+1", then odds are that other reviewers aren't going to take it too seriously. Show that you took the time to review the pull request.
117115

source/getting_started.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -450,9 +450,7 @@ available, Rails errors out.
450450
In the above image, the bottom line has been truncated. Let's see what the full
451451
thing looks like:
452452

453-
<blockquote>
454-
Missing template articles/new, application/new with {locale:[:en], formats:[:html], handlers:[:erb, :builder, :coffee]}. Searched in: * "/path/to/blog/app/views"
455-
</blockquote>
453+
>Missing template articles/new, application/new with {locale:[:en], formats:[:html], handlers:[:erb, :builder, :coffee]}. Searched in: * "/path/to/blog/app/views"
456454
457455
That's quite a lot of text! Let's quickly go through and understand what each
458456
part of it does.
@@ -498,8 +496,8 @@ harmoniously! It's time to create the form for a new article.
498496

499497
### The first form
500498

501-
To create a form within this template, you will use a <em>form
502-
builder</em>. The primary form builder for Rails is provided by a helper
499+
To create a form within this template, you will use a *form
500+
builder*. The primary form builder for Rails is provided by a helper
503501
method called `form_for`. To use this method, add this code into
504502
`app/views/articles/new.html.erb`:
505503

source/i18n.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ The **translations load path** (`I18n.load_path`) is just a Ruby Array of paths
107107

108108
NOTE: The backend will lazy-load these translations when a translation is looked up for the first time. This makes it possible to just swap the backend with something else even after translations have already been announced.
109109

110-
The default `application.rb` files has instructions on how to add locales from another directory and how to set a different default locale. Just uncomment and edit the specific lines.
110+
The default `application.rb` file has instructions on how to add locales from another directory and how to set a different default locale. Just uncomment and edit the specific lines.
111111

112112
```ruby
113113
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
@@ -137,7 +137,7 @@ If you want to translate your Rails application to a **single language other tha
137137

138138
However, you would probably like to **provide support for more locales** in your application. In such case, you need to set and pass the locale between requests.
139139

140-
WARNING: You may be tempted to store the chosen locale in a _session_ or a <em>cookie</em>. However, **do not do this**. The locale should be transparent and a part of the URL. This way you won't break people's basic assumptions about the web itself: if you send a URL to a friend, they should see the same page and content as you. A fancy word for this would be that you're being [<em>RESTful</em>](http://en.wikipedia.org/wiki/Representational_State_Transfer). Read more about the RESTful approach in [Stefan Tilkov's articles](http://www.infoq.com/articles/rest-introduction). Sometimes there are exceptions to this rule and those are discussed below.
140+
WARNING: You may be tempted to store the chosen locale in a _session_ or a *cookie*. However, **do not do this**. The locale should be transparent and a part of the URL. This way you won't break people's basic assumptions about the web itself: if you send a URL to a friend, they should see the same page and content as you. A fancy word for this would be that you're being [*RESTful*](http://en.wikipedia.org/wiki/Representational_State_Transfer). Read more about the RESTful approach in [Stefan Tilkov's articles](http://www.infoq.com/articles/rest-introduction). Sometimes there are exceptions to this rule and those are discussed below.
141141

142142
The _setting part_ is easy. You can set the locale in a `before_action` in the `ApplicationController` like this:
143143

@@ -262,7 +262,7 @@ get '/:locale' => 'dashboard#index'
262262

263263
Do take special care about the **order of your routes**, so this route declaration does not "eat" other ones. (You may want to add it directly before the `root :to` declaration.)
264264

265-
NOTE: Have a look at two plugins which simplify work with routes in this way: Sven Fuchs's [routing_filter](https://github.com/svenfuchs/routing-filter/tree/master) and Raul Murciano's [translate_routes](https://github.com/raul/translate_routes/tree/master).
265+
NOTE: Have a look at two plugins which simplify working with routes in this way: Sven Fuchs's [routing_filter](https://github.com/svenfuchs/routing-filter/tree/master) and Raul Murciano's [translate_routes](https://github.com/raul/translate_routes/tree/master).
266266

267267
### Setting the Locale from the Client Supplied Information
268268

source/security.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ The Gartner Group however estimates that 75% of attacks are at the web applicati
2525

2626
The threats against web applications include user account hijacking, bypass of access control, reading or modifying sensitive data, or presenting fraudulent content. Or an attacker might be able to install a Trojan horse program or unsolicited e-mail sending software, aim at financial enrichment or cause brand name damage by modifying company resources. In order to prevent attacks, minimize their impact and remove points of attack, first of all, you have to fully understand the attack methods in order to find the correct countermeasures. That is what this guide aims at.
2727

28-
In order to develop secure web applications you have to keep up to date on all layers and know your enemies. To keep up to date subscribe to security mailing lists, read security blogs and make updating and security checks a habit (check the <a href="#additional-resources">Additional Resources</a> chapter). It is done manually because that's how you find the nasty logical security problems.
28+
In order to develop secure web applications you have to keep up to date on all layers and know your enemies. To keep up to date subscribe to security mailing lists, read security blogs and make updating and security checks a habit (check the [Additional Resources](#additional-resources) chapter). It is done manually because that's how you find the nasty logical security problems.
2929

3030
Sessions
3131
--------
@@ -68,7 +68,7 @@ Hence, the cookie serves as temporary authentication for the web application. An
6868

6969
* Most people don't clear out the cookies after working at a public terminal. So if the last user didn't log out of a web application, you would be able to use it as this user. Provide the user with a _log-out button_ in the web application, and _make it prominent_.
7070

71-
* Many cross-site scripting (XSS) exploits aim at obtaining the user's cookie. You'll read <a href="#cross-site-scripting-xss">more about XSS</a> later.
71+
* Many cross-site scripting (XSS) exploits aim at obtaining the user's cookie. You'll read [more about XSS](#cross-site-scripting-xss) later.
7272

7373
* Instead of stealing a cookie unknown to the attacker, they fix a user's session identifier (in the cookie) known to them. Read more about this so-called session fixation later.
7474
@@ -187,7 +187,7 @@ This attack method works by including malicious code or a link in a page that ac
187187

188188
![](images/csrf.png)
189189

190-
In the <a href="#sessions">session chapter</a> you have learned that most Rails applications use cookie-based sessions. Either they store the session id in the cookie and have a server-side session hash, or the entire session hash is on the client-side. In either case the browser will automatically send along the cookie on every request to a domain, if it can find a cookie for that domain. The controversial point is, that it will also send the cookie, if the request comes from a site of a different domain. Let's start with an example:
190+
In the [session chapter](#sessions) you have learned that most Rails applications use cookie-based sessions. Either they store the session id in the cookie and have a server-side session hash, or the entire session hash is on the client-side. In either case the browser will automatically send along the cookie on every request to a domain, if it can find a cookie for that domain. The controversial point is, that it will also send the cookie, if the request comes from a site of a different domain. Let's start with an example:
191191

192192
* Bob browses a message board and views a post from a hacker where there is a crafted HTML image element. The element references a command in Bob's project management application, rather than an image file.
193193
* `<img src="http://www.webapp.com/project/1/destroy">`
@@ -257,7 +257,7 @@ end
257257

258258
The above method can be placed in the `ApplicationController` and will be called when a CSRF token is not present or is incorrect on a non-GET request.
259259

260-
Note that _cross-site scripting (XSS) vulnerabilities bypass all CSRF protections_. XSS gives the attacker access to all elements on a page, so they can read the CSRF security token from a form or directly submit the form. Read <a href="#cross-site-scripting-xss">more about XSS</a> later.
260+
Note that _cross-site scripting (XSS) vulnerabilities bypass all CSRF protections_. XSS gives the attacker access to all elements on a page, so they can read the CSRF security token from a form or directly submit the form. Read [more about XSS](#cross-site-scripting-xss) later.
261261

262262
Redirection and Files
263263
---------------------
@@ -477,7 +477,7 @@ config.filter_parameters << :password
477477

478478
INFO: _Do you find it hard to remember all your passwords? Don't write them down, but use the initial letters of each word in an easy to remember sentence._
479479

480-
Bruce Schneier, a security technologist, [has analyzed](http://www.schneier.com/blog/archives/2006/12/realworld_passw.html) 34,000 real-world user names and passwords from the MySpace phishing attack mentioned <a href="#examples-from-the-underground">below</a>. It turns out that most of the passwords are quite easy to crack. The 20 most common passwords are:
480+
Bruce Schneier, a security technologist, [has analyzed](http://www.schneier.com/blog/archives/2006/12/realworld_passw.html) 34,000 real-world user names and passwords from the MySpace phishing attack mentioned [below](#examples-from-the-underground). It turns out that most of the passwords are quite easy to crack. The 20 most common passwords are:
481481

482482
password1, abc123, myspace1, password, blink182, qwerty1, ****you, 123abc, baseball1, football1, 123456, soccer, monkey1, liverpool1, princess1, jordan23, slipknot1, superman1, iloveyou1, and monkey.
483483

@@ -630,7 +630,7 @@ Also, the second query renames some columns with the AS statement so that the we
630630

631631
#### Countermeasures
632632

633-
Ruby on Rails has a built-in filter for special SQL characters, which will escape ' , " , NULL character and line breaks. <em class="highlight">Using `Model.find(id)` or `Model.find_by_some thing(something)` automatically applies this countermeasure</em>. But in SQL fragments, especially <em class="highlight">in conditions fragments (`where("...")`), the `connection.execute()` or `Model.find_by_sql()` methods, it has to be applied manually</em>.
633+
Ruby on Rails has a built-in filter for special SQL characters, which will escape ' , " , NULL character and line breaks. *Using `Model.find(id)` or `Model.find_by_some thing(something)` automatically applies this countermeasure*. But in SQL fragments, especially *in conditions fragments (`where("...")`), the `connection.execute()` or `Model.find_by_sql()` methods, it has to be applied manually*.
634634

635635
Instead of passing a string to the conditions option, you can pass an array to sanitize tainted strings like this:
636636

source/testing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ In Rails, models tests are what you write to test your models.
144144

145145
For this guide we will be using Rails _scaffolding_. It will create the model, a migration, controller and views for the new resource in a single operation. It will also create a full test suite following Rails best practices. We will be using examples from this generated code and will be supplementing it with additional examples where necessary.
146146

147-
NOTE: For more information on Rails <i>scaffolding</i>, refer to [Getting Started with Rails](getting_started.html)
147+
NOTE: For more information on Rails _scaffolding_, refer to [Getting Started with Rails](getting_started.html)
148148

149149
When you use `rails generate scaffold`, for a resource among other things it creates a test stub in the `test/models` folder:
150150

0 commit comments

Comments
 (0)