aboutsummaryrefslogtreecommitdiffstats
path: root/guides
diff options
context:
space:
mode:
Diffstat (limited to 'guides')
-rw-r--r--guides/assets/stylesheets/main.css104
-rw-r--r--guides/rails_guides/markdown/renderer.rb2
-rw-r--r--guides/source/4_0_release_notes.md39
-rw-r--r--guides/source/contributing_to_ruby_on_rails.md38
-rw-r--r--guides/source/working_with_javascript_in_rails.md4
5 files changed, 134 insertions, 53 deletions
diff --git a/guides/assets/stylesheets/main.css b/guides/assets/stylesheets/main.css
index 9f5e101d1c..589c96e0e9 100644
--- a/guides/assets/stylesheets/main.css
+++ b/guides/assets/stylesheets/main.css
@@ -26,11 +26,13 @@ dl { margin: 0 0 1.5em 0; }
dl dt { font-weight: bold; }
dd { margin-left: 1.5em;}
-pre,code { margin: 1.5em 0; overflow: auto; color: #222;}
-pre,code {
- font-size: 1em;
- font-family: "Anonymous Pro", "Inconsolata", "Menlo", "Consolas", "Bitstream Vera Sans Mono", "Courier New", monospace;
- line-height: 1.5;
+pre, code {
+ font-size: 1em;
+ font-family: "Anonymous Pro", "Inconsolata", "Menlo", "Consolas", "Bitstream Vera Sans Mono", "Courier New", monospace;
+ line-height: 1.5;
+ margin: 1.5em 0;
+ overflow: auto;
+ color: #222;
}
pre,tt,code,.note>p {
white-space: pre-wrap; /* css-3 */
@@ -92,14 +94,14 @@ body {
line-height: 1.5em;
background: #fff;
color: #999;
- }
+}
.wrapper {
text-align: left;
margin: 0 auto;
max-width: 960px;
padding: 0 1em;
- }
+}
.red-button {
display: inline-block;
@@ -164,7 +166,6 @@ body {
.more-info:last-child:after {
content: "";
}
-
}
@media screen and (max-width: 1024px) {
@@ -218,7 +219,7 @@ body {
color: #FFF;
padding: 1.5em 0;
z-index: 99;
- }
+}
#feature {
background: #d5e9f6 url(../images/feature_tile.gif) repeat-x;
@@ -229,12 +230,12 @@ body {
#container {
color: #333;
padding: 0.5em 0 1.5em 0;
- }
+}
#mainCol {
max-width: 630px;
margin-left: 2em;
- }
+}
#subCol {
position: absolute;
@@ -247,7 +248,7 @@ body {
font-size: 0.9285em;
line-height: 1.3846em;
margin-right: 1em;
- }
+}
@media screen and (max-width: 800px) {
@@ -265,7 +266,7 @@ body {
#footer {
padding: 2em 0;
background: #222 url(../images/footer_tile.gif) repeat-x;
- }
+}
#footer .wrapper {
padding-left: 1em;
max-width: 960px;
@@ -284,12 +285,11 @@ body {
a, a:link, a:visited {
color: #ee3f3f;
text-decoration: underline;
- }
+}
#mainCol a, #subCol a, #feature a {color: #980905;}
#mainCol a code, #subCol a code, #feature a code {color: #980905;}
-
/* Navigation
--------------------------------------- */
@@ -313,7 +313,6 @@ a, a:link, a:visited {
background: #980905;
position: relative;
color: white;
- cursor: pointer;
}
.guides-index .guides-index-item {
@@ -345,7 +344,6 @@ a, a:link, a:visited {
}
@media screen and (max-width: 480px) {
-
.nav {
float: none;
width: 100%;
@@ -408,7 +406,8 @@ a, a:link, a:visited {
padding: 0;
}
#guides dt {padding:0; margin: 0.5em 0 0;}
-#guides a {color: #FFF; background: none !important;}
+#guides a {color: #FFF; background: none !important; text-decoration: none;}
+#guides a:hover {text-decoration: underline;}
#guides .L, #guides .R {float: left; width: 50%; margin: 0; padding: 0;}
#guides .R {float: right;}
#guides hr {
@@ -427,14 +426,14 @@ h1 {
line-height: 1em;
margin: 0.6em 0 .2em;
font-weight: bold;
- }
+}
h2 {
font-size: 2.1428em;
line-height: 1em;
margin: 0.7em 0 .2333em;
font-weight: bold;
- }
+}
@media screen and (max-width: 480px) {
h2 {
@@ -447,7 +446,7 @@ h3 {
line-height: 1.286em;
margin: 0.875em 0 0.2916em;
font-weight: bold;
- }
+}
@media screen and (max-width: 480px) {
h3 {
@@ -460,7 +459,7 @@ h4 {
line-height: 1.2em;
margin: 1.6667em 0 .3887em;
font-weight: bold;
- }
+}
h5 {
font-size: 1em;
@@ -474,7 +473,7 @@ h6 {
line-height: 1.5em;
margin: 1em 0 .5em;
font-weight: normal;
- }
+}
.section {
padding-bottom: 0.25em;
@@ -542,13 +541,19 @@ h6 {
}
#mainCol dt, #subCol dt {
- font-size: 1em;
+ font-size: 1.2857em;
padding: 0.125em 0 0.25em 0;
margin-bottom: 0;
/*background: url(../images/book_icon.gif) no-repeat left top;
padding: 0.125em 0 0.25em 28px;*/
}
+@media screen and (max-width: 480px) {
+ #mainCol dt, #subCol dt {
+ font-size: 1em;
+ }
+}
+
#mainCol dd.work-in-progress, #subCol dd.work-in-progress {
background: #fff9d8 url(../images/tab_yellow.gif) no-repeat left top;
border: none;
@@ -609,10 +614,10 @@ div.code_container {
}
#mainCol div.todo {
- background: #fff9d8 url(../images/tab_yellow.gif) no-repeat left top;
- border: none;
- padding: 1em 1em 0.25em 48px;
- margin: 0.25em 0 1.5em 0;
+ background: #fff9d8 url(../images/tab_yellow.gif) no-repeat left top;
+ border: none;
+ padding: 1em 1em 0.25em 48px;
+ margin: 0.25em 0 1.5em 0;
}
.note code, .info code, .todo code {border:none; background: none; padding: 0;}
@@ -640,11 +645,11 @@ div.code_container {
--------------------------------------- */
.clearfix:after {
- content: ".";
- display: block;
- height: 0;
- clear: both;
- visibility: hidden;
+ content: ".";
+ display: block;
+ height: 0;
+ clear: both;
+ visibility: hidden;
}
.clearfix {display: inline-block;}
@@ -655,13 +660,13 @@ div.code_container {
/* Same bottom margin for special boxes than for regular paragraphs, this way
intermediate whitespace looks uniform. */
div.code_container, div.important, div.caution, div.warning, div.note, div.info {
- margin-bottom: 1.5em;
+ margin-bottom: 1.5em;
}
/* Remove bottom margin of paragraphs in special boxes, otherwise they get a
spurious blank area below with the box background. */
div.important p, div.caution p, div.warning p, div.note p, div.info p {
- margin-bottom: 1em;
+ margin-bottom: 1em;
}
/* Edge Badge
@@ -683,19 +688,18 @@ table td, table th { padding: 9px 10px; text-align: left; }
/* Mobile */
@media only screen and (max-width: 767px) {
-
- table.responsive { margin-bottom: 0; }
-
- .pinned { position: absolute; left: 0; top: 0; background: #fff; width: 35%; overflow: hidden; overflow-x: scroll; border-right: 1px solid #ccc; border-left: 1px solid #ccc; }
- .pinned table { border-right: none; border-left: none; width: 100%; }
- .pinned table th, .pinned table td { white-space: nowrap; }
- .pinned td:last-child { border-bottom: 0; }
-
- div.table-wrapper { position: relative; margin-bottom: 20px; overflow: hidden; border-right: 1px solid #ccc; }
- div.table-wrapper div.scrollable table { margin-left: 35%; }
- div.table-wrapper div.scrollable { overflow: scroll; overflow-y: hidden; }
-
- table.responsive td, table.responsive th { position: relative; white-space: nowrap; overflow: hidden; }
- table.responsive th:first-child, table.responsive td:first-child, table.responsive td:first-child, table.responsive.pinned td { display: none; }
-
+ table.responsive { margin-bottom: 0; }
+
+ .pinned { position: absolute; left: 0; top: 0; background: #fff; width: 35%; overflow: hidden; overflow-x: scroll; border-right: 1px solid #ccc; border-left: 1px solid #ccc; }
+ .pinned table { border-right: none; border-left: none; width: 100%; }
+ .pinned table th, .pinned table td { white-space: nowrap; }
+ .pinned td:last-child { border-bottom: 0; }
+
+ div.table-wrapper { position: relative; margin-bottom: 20px; overflow: hidden; border-right: 1px solid #ccc; }
+ div.table-wrapper div.scrollable table { margin-left: 35%; }
+ div.table-wrapper div.scrollable { overflow: scroll; overflow-y: hidden; }
+
+ table.responsive td, table.responsive th { position: relative; white-space: nowrap; overflow: hidden; }
+ table.responsive th:first-child, table.responsive td:first-child, table.responsive td:first-child, table.responsive.pinned td { display: none; }
+
}
diff --git a/guides/rails_guides/markdown/renderer.rb b/guides/rails_guides/markdown/renderer.rb
index 2f36af1fb3..c3fe5b8799 100644
--- a/guides/rails_guides/markdown/renderer.rb
+++ b/guides/rails_guides/markdown/renderer.rb
@@ -9,7 +9,7 @@ module RailsGuides
<<-HTML
<div class="code_container">
<pre class="brush: #{brush_for(language)}; gutter: false; toolbar: false">
-#{ERB::Util.h(code).strip}
+#{ERB::Util.h(code)}
</pre>
</div>
HTML
diff --git a/guides/source/4_0_release_notes.md b/guides/source/4_0_release_notes.md
index f24a981c6e..ecb8dd04f5 100644
--- a/guides/source/4_0_release_notes.md
+++ b/guides/source/4_0_release_notes.md
@@ -74,9 +74,48 @@ Documentation
* Guides are rewritten in GitHub Flavored Markdown.
+* Guides have a responsive design.
+
Railties
--------
+* Ensure that RAILS_ENV is set when accessing Rails.env.
+
+* Don't eager-load app/assets and app/views.
+
+* Add `.rake` to list of file extensions included by `rake notes` and `rake notes:custom`.
+
+* New test locations `test/models`, `test/helpers`, `test/controllers`, and `test/mailers`. Corresponding rake tasks added as well.
+
+* Set a different cache per environment for assets pipeline through `config.assets.cache`.
+
+* `Rails.public_path` now returns a Pathname object.
+
+* Remove highly uncommon `config.assets.manifest` option for moving the manifest path. This option is now unsupported in sprockets-rails.
+
+* Add `config.action_controller.permit_all_parameters` to disable StrongParameters protection, it's false by default.
+
+* Remove `config.active_record.whitelist_attributes` and `config.active_record.mass_assignment_sanitizer` from new applications since MassAssignmentSecurity has been extracted from Rails.
+
+* Change `rails new` and `rails plugin new` generators to name the `.gitkeep` files as `.keep` in a more SCM-agnostic way. Change `--skip-git` option to only skip the `.gitignore` file and still generate the `.keep` files. Add `--skip-keeps` option to skip the `.keep` files.
+
+* Fixed support for DATABASE_URL environment variable for rake db tasks.
+
+* rails dbconsole now can use SSL for MySQL. The database.yml options sslca, sslcert, sslcapath, sslcipher and sslkey now affect rails dbconsole.
+
+* Correctly handle SCRIPT_NAME when generating routes to engine in application that's mounted at a sub-uri. With this behavior, you *should not* use default_url_options[:script_name] to set proper application's mount point by yourself.
+
+* `config.threadsafe!` is deprecated in favor of `config.eager_load` which provides a more fine grained control on what is eager loaded.
+
+* The migration generator will now produce AddXXXToYYY/RemoveXXXFromYYY migrations with references statements, for instance
+
+ rails g migration AddReferencesToProducts user:references supplier:references{polymorphic}
+
+ will generate the migration with:
+
+ add_reference :products, :user, index: true
+ add_reference :products, :supplier, polymorphic: true, index: true
+
* Allow scaffold/model/migration generators to accept a `polymorphic` modifier for `references`/`belongs_to`, for instance
```
diff --git a/guides/source/contributing_to_ruby_on_rails.md b/guides/source/contributing_to_ruby_on_rails.md
index 3791467584..01bc26c4d5 100644
--- a/guides/source/contributing_to_ruby_on_rails.md
+++ b/guides/source/contributing_to_ruby_on_rails.md
@@ -376,6 +376,44 @@ Now you need to get other people to look at your patch, just as you've looked at
It’s entirely possible that the feedback you get will suggest changes. Don’t get discouraged: the whole point of contributing to an active open source project is to tap into community knowledge. If people are encouraging you to tweak your code, then it’s worth making the tweaks and resubmitting. If the feedback is that your code doesn’t belong in the core, you might still think about releasing it as a gem.
+#### Squashing commits
+
+One of the things that we may ask you to do is "squash your commits," which
+will combine all of your commits into a single commit. We prefer pull requests
+that are a single commit. This makes it easier to backport changes to stable
+branches, squashing makes it easier to revert bad commits, and the git history
+can be a bit easier to follow. Rails is a large project, and a bunch of
+extraneous commits can add a lot of noise.
+
+In order to do this, you'll need to have a git remote that points at the main
+Rails repository. This is useful anyway, but just in case you don't have it set
+up, make sure that you do this first:
+
+```bash
+$ git remote add upstream https://github.com/rails/rails.git
+```
+
+You can call this remote whatever you'd like, but if you don't use `upstream`,
+then change the name to your own in the instructions below.
+
+Given that your remote branch is called `my_pull_request`, then you can do the
+following:
+
+```bash
+$ git fetch upstream
+$ git checkout my_pull_request
+$ git rebase upstream/master
+$ git rebase -i
+
+< Choose 'squash' for all of your commits except the first one. >
+< Edit the commit message to make sense, and describe all your changes. >
+
+$ git push origin my_pull_request -f
+```
+
+You should be able to refresh the pull request on GitHub and see that it has
+been updated.
+
### Backporting
Changes that are merged into master are intended for the next major release of Rails. Sometimes, it might be beneficial for your changes to propagate back to the maintenance releases for older stable branches. Generally, security fixes and bug fixes are good candidates for a backport, while new features and patches that introduce a change in behavior will not be accepted. When in doubt, it is best to consult a Rails team member before backporting your changes to avoid wasted effort.
diff --git a/guides/source/working_with_javascript_in_rails.md b/guides/source/working_with_javascript_in_rails.md
index 011303c311..10b9dddd02 100644
--- a/guides/source/working_with_javascript_in_rails.md
+++ b/guides/source/working_with_javascript_in_rails.md
@@ -322,7 +322,7 @@ this:
end
```
-Notice the format.js in the respond_to block; that allows the controller to
+Notice the format.js in the `respond_to` block; that allows the controller to
respond to your Ajax request. You then have a corresponding
`app/views/users/create.js.erb` view file that generates the actual JavaScript
code that will be sent and executed on the client side.
@@ -379,7 +379,7 @@ $(document).on "page:change", ->
For more details, including other events you can bind to, check out [the
Turbolinks
-README](https://github.com/rails/turbolinks/blob/ec9ca4d6cf9626e03a672f3b9e7968c816aff94e/README.md).
+README](https://github.com/rails/turbolinks/blob/master/README.md).
Other Resources
---------------