From 36e5368e76f5256ad391a17c2fa4eb4b8a0dde2a Mon Sep 17 00:00:00 2001
From: Anuj Dutta
Date: Sun, 19 May 2013 19:31:50 +0100
Subject: Update filter_parameters related docs, as they have been moved to
initializers.
---
guides/source/configuring.md | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
(limited to 'guides/source')
diff --git a/guides/source/configuring.md b/guides/source/configuring.md
index 9e40165d15..ddb56623f1 100644
--- a/guides/source/configuring.md
+++ b/guides/source/configuring.md
@@ -30,10 +30,10 @@ Configuring Rails Components
In general, the work of configuring Rails means configuring the components of Rails, as well as configuring Rails itself. The configuration file `config/application.rb` and environment-specific configuration files (such as `config/environments/production.rb`) allow you to specify the various settings that you want to pass down to all of the components.
-For example, the default `config/application.rb` file includes this setting:
+For example, the `config/application.rb` file includes this setting:
```ruby
-config.filter_parameters += [:password]
+config.autoload_paths += %W(#{config.root}/extras)
```
This is a setting for Rails itself. If you want to pass settings to individual Rails components, you can do so via the same `config` object in `config/application.rb`:
@@ -97,7 +97,9 @@ These configuration methods are to be called on a `Rails::Railtie` object, such
* `config.file_watcher` the class used to detect file updates in the filesystem when `config.reload_classes_only_on_change` is true. Must conform to `ActiveSupport::FileUpdateChecker` API.
-* `config.filter_parameters` used for filtering out the parameters that you don't want shown in the logs, such as passwords or credit card numbers.
+* `config.filter_parameters` used for filtering out the parameters that
+you don't want shown in the logs, such as passwords or credit card
+numbers. New applications filter out passwords by adding the following `config.filter_parameters+=[:password]` in `config/initializers/filter_parameter_logging.rb`.
* `config.force_ssl` forces all requests to be under HTTPS protocol by using `ActionDispatch::SSL` middleware.
--
cgit v1.2.3
From ef82b2c2d49c2a867a8d0ef1be709adc5170361c Mon Sep 17 00:00:00 2001
From: Anuj Dutta
Date: Sun, 19 May 2013 19:33:13 +0100
Subject: Update configuration docs for assets.enabled, as it's set true by
default in the configuration and doesn't appear in the config files anymore.
---
guides/source/configuring.md | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
(limited to 'guides/source')
diff --git a/guides/source/configuring.md b/guides/source/configuring.md
index ddb56623f1..d71ff0c7d5 100644
--- a/guides/source/configuring.md
+++ b/guides/source/configuring.md
@@ -133,7 +133,8 @@ numbers. New applications filter out passwords by adding the following `config.f
### Configuring Assets
-* `config.assets.enabled` a flag that controls whether the asset pipeline is enabled. It is explicitly initialized in `config/application.rb`.
+* `config.assets.enabled` a flag that controls whether the asset
+pipeline is enabled. It is set to true by default.
* `config.assets.compress` a flag that enables the compression of compiled assets. It is explicitly set to true in `config/production.rb`.
--
cgit v1.2.3
From cd27ffbdde958d508a51bf237b7dd7e8fe99766c Mon Sep 17 00:00:00 2001
From: Mikhail Dieterle
Date: Wed, 22 May 2013 12:17:25 +0300
Subject: In rails 4 there are much more ways to retrieve a single object
---
guides/source/active_record_querying.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'guides/source')
diff --git a/guides/source/active_record_querying.md b/guides/source/active_record_querying.md
index 19b214f114..5e1fdc78a5 100644
--- a/guides/source/active_record_querying.md
+++ b/guides/source/active_record_querying.md
@@ -91,7 +91,7 @@ The primary operation of `Model.find(options)` can be summarized as:
### Retrieving a Single Object
-Active Record provides five different ways of retrieving a single object.
+Active Record provides several different ways of retrieving a single object.
#### Using a Primary Key
--
cgit v1.2.3
From 54ce21ee8d59835dba8fa167ad79490fbba0ca17 Mon Sep 17 00:00:00 2001
From: Neeraj Singh
Date: Wed, 22 May 2013 10:37:37 -0400
Subject: Added an example for primary_key option
---
guides/source/association_basics.md | 14 ++++++++++++++
1 file changed, 14 insertions(+)
(limited to 'guides/source')
diff --git a/guides/source/association_basics.md b/guides/source/association_basics.md
index 16a5241319..1590f1d81b 100644
--- a/guides/source/association_basics.md
+++ b/guides/source/association_basics.md
@@ -1511,6 +1511,20 @@ end
By convention, Rails assumes that the column used to hold the primary key of the association is `id`. You can override this and explicitly specify the primary key with the `:primary_key` option.
+Let's say that `users` table has `id` as the primary_key but it also has
+`guid` column. And the requirement is that `todos` table should hold
+`guid` column value and not `id` value. This can be achieved like this
+
+```ruby
+class User < ActiveRecord::Base
+ has_many :todos, primary_key: :guid
+end
+```
+
+Now if we execute `@user.todos.create` then `@todo` record will have
+`user_id` value as the `guid` value of `@user`.
+
+
##### `:source`
The `:source` option specifies the source association name for a `has_many :through` association. You only need to use this option if the name of the source association cannot be automatically inferred from the association name.
--
cgit v1.2.3
From 122e8dc1e9fab32f56e13902fb2a2c509716acfa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Luka=20Mar=C4=8Deti=C4=87?=
Date: Mon, 27 May 2013 03:31:13 +0200
Subject: Correct the assertion that join table columns have no options, mind
context.
---
guides/source/migrations.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
(limited to 'guides/source')
diff --git a/guides/source/migrations.md b/guides/source/migrations.md
index 550f8fdc3c..1ad8db12eb 100644
--- a/guides/source/migrations.md
+++ b/guides/source/migrations.md
@@ -377,8 +377,8 @@ create_join_table :products, :categories, table_name: :categorization
will create a `categorization` table.
-By default, `create_join_table` will create two columns with no options, but
-you can specify these options using the `:column_options` option. For example,
+For the two table columns, you can override the default `:null` option, or add
+others, by specifying the `:column_options` option. For example,
```ruby
create_join_table :products, :categories, column_options: {null: true}
--
cgit v1.2.3
From ff684ea3bfa7e448b60f6ab2e8f3feb60f48d7f9 Mon Sep 17 00:00:00 2001
From: Dan Erikson
Date: Mon, 27 May 2013 13:52:04 -0600
Subject: Fixed quotes in environment example in Rails Application Templates
guide.
---
guides/source/rails_application_templates.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'guides/source')
diff --git a/guides/source/rails_application_templates.md b/guides/source/rails_application_templates.md
index b548eaede8..f8062a1f7c 100644
--- a/guides/source/rails_application_templates.md
+++ b/guides/source/rails_application_templates.md
@@ -91,7 +91,7 @@ Adds a line inside the `Application` class for `config/application.rb`.
If `options[:env]` is specified, the line is appended to the corresponding file in `config/environments`.
```ruby
-environment 'config.action_mailer.default_url_options = {host: 'http://yourwebsite.example.com'}, env: 'production'
+environment 'config.action_mailer.default_url_options = {host: "http://yourwebsite.example.com"}', env: 'production'
```
A block can be used in place of the `data` argument.
--
cgit v1.2.3
From 666d028bb82428a0649935b1d1814db0e20a406f Mon Sep 17 00:00:00 2001
From: Sunny Ripert
Date: Tue, 28 May 2013 14:19:22 +0200
Subject: End-of-line whitespace hunt
---
guides/source/active_record_validations.md | 4 ++--
guides/source/api_documentation_guidelines.md | 4 ++--
guides/source/association_basics.md | 24 +++++++++++------------
guides/source/getting_started.md | 16 +++++++--------
guides/source/ruby_on_rails_guides_guidelines.md | 2 +-
guides/source/testing.md | 2 +-
guides/source/working_with_javascript_in_rails.md | 2 +-
7 files changed, 27 insertions(+), 27 deletions(-)
(limited to 'guides/source')
diff --git a/guides/source/active_record_validations.md b/guides/source/active_record_validations.md
index 621d2222ff..ebf4e58444 100644
--- a/guides/source/active_record_validations.md
+++ b/guides/source/active_record_validations.md
@@ -677,13 +677,13 @@ class GoodnessValidator
def initialize(person)
@person = person
end
-
+
def validate
if some_complex_condition_involving_ivars_and_private_methods?
@person.errors[:base] << "This person is evil"
end
end
-
+
# …
end
```
diff --git a/guides/source/api_documentation_guidelines.md b/guides/source/api_documentation_guidelines.md
index d0499878da..d2fdbc7ac0 100644
--- a/guides/source/api_documentation_guidelines.md
+++ b/guides/source/api_documentation_guidelines.md
@@ -25,7 +25,7 @@ Write in present tense: "Returns a hash that...", rather than "Returned a hash t
Start comments in upper case. Follow regular punctuation rules:
```ruby
-# Declares an attribute reader backed by an internally-named
+# Declares an attribute reader backed by an internally-named
# instance variable.
def attr_internal_reader(*attrs)
...
@@ -57,7 +57,7 @@ Use two spaces to indent chunks of code--that is, for markup purposes, two space
Short docs do not need an explicit "Examples" label to introduce snippets; they just follow paragraphs:
```ruby
-# Converts a collection of elements into a formatted string by
+# Converts a collection of elements into a formatted string by
# calling +to_s+ on all elements and joining them.
#
# Blog.all.to_formatted_s # => "First PostSecond PostThird Post"
diff --git a/guides/source/association_basics.md b/guides/source/association_basics.md
index 1590f1d81b..04a77c3284 100644
--- a/guides/source/association_basics.md
+++ b/guides/source/association_basics.md
@@ -1692,7 +1692,7 @@ person.posts.inspect # => [#, #]
Reading.all.inspect # => [#, #]
```
-In the above case there are two readings and `person.posts` brings out both of
+In the above case there are two readings and `person.posts` brings out both of
them even though these records are pointing to the same post.
Now let's set `distinct`:
@@ -1711,24 +1711,24 @@ person.posts.inspect # => [#]
Reading.all.inspect # => [#, #]
```
-In the above case there are still two readings. However `person.posts` shows
+In the above case there are still two readings. However `person.posts` shows
only one post because the collection loads only unique records.
-If you want to make sure that, upon insertion, all of the records in the
-persisted association are distinct (so that you can be sure that when you
-inspect the association that you will never find duplicate records), you should
-add a unique index on the table itself. For example, if you have a table named
-``person_posts`` and you want to make sure all the posts are unique, you could
+If you want to make sure that, upon insertion, all of the records in the
+persisted association are distinct (so that you can be sure that when you
+inspect the association that you will never find duplicate records), you should
+add a unique index on the table itself. For example, if you have a table named
+``person_posts`` and you want to make sure all the posts are unique, you could
add the following in a migration:
```ruby
add_index :person_posts, :post, :unique => true
```
-Note that checking for uniqueness using something like ``include?`` is subject
-to race conditions. Do not attempt to use ``include?`` to enforce distinctness
-in an association. For instance, using the post example from above, the
-following code would be racy because multiple users could be attempting this
+Note that checking for uniqueness using something like ``include?`` is subject
+to race conditions. Do not attempt to use ``include?`` to enforce distinctness
+in an association. For instance, using the post example from above, the
+following code would be racy because multiple users could be attempting this
at the same time:
```ruby
@@ -1942,7 +1942,7 @@ TIP: The `:foreign_key` and `:association_foreign_key` options are useful when s
```ruby
class User < ActiveRecord::Base
- has_and_belongs_to_many :friends,
+ has_and_belongs_to_many :friends,
class_name: "User",
foreign_key: "this_user_id",
association_foreign_key: "other_user_id"
diff --git a/guides/source/getting_started.md b/guides/source/getting_started.md
index 599e47949d..34590fefa5 100644
--- a/guides/source/getting_started.md
+++ b/guides/source/getting_started.md
@@ -264,7 +264,7 @@ Blog::Application.routes.draw do
end
```
-If you run `rake routes`, you'll see that all the routes for the
+If you run `rake routes`, you'll see that all the routes for the
standard RESTful actions.
```bash
@@ -534,7 +534,7 @@ def create
@post = Post.new(params[:post])
@post.save
- redirect_to @post
+ redirect_to @post
end
```
@@ -553,14 +553,14 @@ whether the model was saved or not.
If you submit the form again now, Rails will complain about not finding
the `show` action. That's not very useful though, so let's add the
-`show` action before proceeding.
+`show` action before proceeding.
```ruby
post GET /posts/:id(.:format) posts#show
```
The special syntax `:id` tells rails that this route expects an `:id`
-parameter, which in our case will be the id of the post.
+parameter, which in our case will be the id of the post.
As we did before, we need to add the `show` action in
`app/controllers/posts_controller.rb` and its respective view.
@@ -621,7 +621,7 @@ Visit and give it a try!
### Listing all posts
-We still need a way to list all our posts, so let's do that.
+We still need a way to list all our posts, so let's do that.
We'll use a specific route from `config/routes.rb`:
```ruby
@@ -763,7 +763,7 @@ def create
@post = Post.new(params[:post].permit(:title, :text))
if @post.save
- redirect_to @post
+ redirect_to @post
else
render 'new'
end
@@ -1084,7 +1084,7 @@ together.
```
-Here we're using `link_to` in a different way. We pass the named route as the first argument,
+Here we're using `link_to` in a different way. We pass the named route as the first argument,
and then the final two keys as another argument. The `:method` and `:'data-confirm'`
options are used as HTML5 attributes so that when the link is clicked,
Rails will first show a confirm dialog to the user, and then submit the link with method `delete`.
@@ -1095,7 +1095,7 @@ generated the application. Without this file, the confirmation dialog box wouldn

Congratulations, you can now create, show, list, update and destroy
-posts.
+posts.
TIP: In general, Rails encourages the use of resources objects in place
of declaring routes manually.
diff --git a/guides/source/ruby_on_rails_guides_guidelines.md b/guides/source/ruby_on_rails_guides_guidelines.md
index d5d1ee0a38..5564b0648b 100644
--- a/guides/source/ruby_on_rails_guides_guidelines.md
+++ b/guides/source/ruby_on_rails_guides_guidelines.md
@@ -63,7 +63,7 @@ Those guidelines apply also to guides.
HTML Guides
-----------
-Before generating the guides, make sure that you have the latest version of Bundler installed on your system. As of this writing, you must install Bundler 1.3.5 on your device.
+Before generating the guides, make sure that you have the latest version of Bundler installed on your system. As of this writing, you must install Bundler 1.3.5 on your device.
To install the latest version of Bundler, simply run the `gem install bundler` command
diff --git a/guides/source/testing.md b/guides/source/testing.md
index b02d0b663c..e33e5d9783 100644
--- a/guides/source/testing.md
+++ b/guides/source/testing.md
@@ -159,7 +159,7 @@ class PostTest < ActiveSupport::TestCase
The `PostTest` class defines a _test case_ because it inherits from `ActiveSupport::TestCase`. `PostTest` thus has all the methods available from `ActiveSupport::TestCase`. You'll see those methods a little later in this guide.
-Any method defined within a class inherited from `MiniTest::Unit::TestCase`
+Any method defined within a class inherited from `MiniTest::Unit::TestCase`
(which is the superclass of `ActiveSupport::TestCase`) that begins with `test` (case sensitive) is simply called a test. So, `test_password`, `test_valid_password` and `testValidPassword` all are legal test names and are run automatically when the test case is run.
Rails adds a `test` method that takes a test name and a block. It generates a normal `MiniTest::Unit` test with method names prefixed with `test_`. So,
diff --git a/guides/source/working_with_javascript_in_rails.md b/guides/source/working_with_javascript_in_rails.md
index ddefaf6ff8..22a59cdfec 100644
--- a/guides/source/working_with_javascript_in_rails.md
+++ b/guides/source/working_with_javascript_in_rails.md
@@ -394,4 +394,4 @@ Here are some helpful links to help you learn even more:
* [jquery-ujs list of external articles](https://github.com/rails/jquery-ujs/wiki/External-articles)
* [Rails 3 Remote Links and Forms: A Definitive Guide](http://www.alfajango.com/blog/rails-3-remote-links-and-forms/)
* [Railscasts: Unobtrusive JavaScript](http://railscasts.com/episodes/205-unobtrusive-javascript)
-* [Railscasts: Turbolinks](http://railscasts.com/episodes/390-turbolinks)
\ No newline at end of file
+* [Railscasts: Turbolinks](http://railscasts.com/episodes/390-turbolinks)
--
cgit v1.2.3
From 606c09b8dbaa65ab124baaa0ee62a885a25a2222 Mon Sep 17 00:00:00 2001
From: Sunny Ripert
Date: Tue, 28 May 2013 14:34:47 +0200
Subject: Consistent use of one space only after punctuation
---
guides/source/4_0_release_notes.md | 2 +-
guides/source/action_controller_overview.md | 2 +-
guides/source/action_mailer_basics.md | 2 +-
guides/source/active_support_core_extensions.md | 4 ++--
guides/source/configuring.md | 6 +++---
guides/source/getting_started.md | 6 +++---
guides/source/routing.md | 4 ++--
guides/source/testing.md | 4 ++--
guides/source/upgrading_ruby_on_rails.md | 2 +-
9 files changed, 16 insertions(+), 16 deletions(-)
(limited to 'guides/source')
diff --git a/guides/source/4_0_release_notes.md b/guides/source/4_0_release_notes.md
index b9dbe820c8..840dd049a7 100644
--- a/guides/source/4_0_release_notes.md
+++ b/guides/source/4_0_release_notes.md
@@ -143,7 +143,7 @@ Please refer to the [Changelog](https://github.com/rails/rails/blob/master/activ
* Deprecates the compatibility method Module#local_constant_names, use Module#local_constants instead (which returns symbols).
-* BufferedLogger is deprecated. Use ActiveSupport::Logger, or the logger from Ruby standard library.
+* BufferedLogger is deprecated. Use ActiveSupport::Logger, or the logger from Ruby standard library.
* Deprecate `assert_present` and `assert_blank` in favor of `assert object.blank?` and `assert object.present?`
diff --git a/guides/source/action_controller_overview.md b/guides/source/action_controller_overview.md
index 28939f307f..2701f5bb72 100644
--- a/guides/source/action_controller_overview.md
+++ b/guides/source/action_controller_overview.md
@@ -257,7 +257,7 @@ params.require(:log_entry).permit!
```
This will mark the `:log_entry` parameters hash and any subhash of it
-permitted. Extreme care should be taken when using `permit!` as it
+permitted. Extreme care should be taken when using `permit!` as it
will allow all current and future model attributes to be
mass-assigned.
diff --git a/guides/source/action_mailer_basics.md b/guides/source/action_mailer_basics.md
index c351339117..1f3f2a933e 100644
--- a/guides/source/action_mailer_basics.md
+++ b/guides/source/action_mailer_basics.md
@@ -496,7 +496,7 @@ end
There may be cases in which you want to skip the template rendering step and
supply the email body as a string. You can achieve this using the `:body`
-option. In such cases don't forget to add the `:content_type` option. Rails
+option. In such cases don't forget to add the `:content_type` option. Rails
will default to `text/plain` otherwise.
```ruby
diff --git a/guides/source/active_support_core_extensions.md b/guides/source/active_support_core_extensions.md
index c012ded888..274cffbfab 100644
--- a/guides/source/active_support_core_extensions.md
+++ b/guides/source/active_support_core_extensions.md
@@ -1038,7 +1038,7 @@ For convenience `class_attribute` also defines an instance predicate which is th
When `:instance_reader` is `false`, the instance predicate returns a `NoMethodError` just like the reader method.
-If you do not want the instance predicate, pass `instance_predicate: false` and it will not be defined.
+If you do not want the instance predicate, pass `instance_predicate: false` and it will not be defined.
NOTE: Defined in `active_support/core_ext/class/attribute.rb`
@@ -1423,7 +1423,7 @@ The method `pluralize` returns the plural of its receiver:
As the previous example shows, Active Support knows some irregular plurals and uncountable nouns. Built-in rules can be extended in `config/initializers/inflections.rb`. That file is generated by the `rails` command and has instructions in comments.
-`pluralize` can also take an optional `count` parameter. If `count == 1` the singular form will be returned. For any other value of `count` the plural form will be returned:
+`pluralize` can also take an optional `count` parameter. If `count == 1` the singular form will be returned. For any other value of `count` the plural form will be returned:
```ruby
"dude".pluralize(0) # => "dudes"
diff --git a/guides/source/configuring.md b/guides/source/configuring.md
index d71ff0c7d5..ee0d373287 100644
--- a/guides/source/configuring.md
+++ b/guides/source/configuring.md
@@ -424,13 +424,13 @@ There are a few configuration options available in Active Support:
### Configuring a Database
-Just about every Rails application will interact with a database. The database to use is specified in a configuration file called `config/database.yml`. If you open this file in a new Rails application, you'll see a default database configured to use SQLite3. The file contains sections for three different environments in which Rails can run by default:
+Just about every Rails application will interact with a database. The database to use is specified in a configuration file called `config/database.yml`. If you open this file in a new Rails application, you'll see a default database configured to use SQLite3. The file contains sections for three different environments in which Rails can run by default:
* The `development` environment is used on your development/local computer as you interact manually with the application.
* The `test` environment is used when running automated tests.
* The `production` environment is used when you deploy your application for the world to use.
-TIP: You don't have to update the database configurations manually. If you look at the options of the application generator, you will see that one of the options is named `--database`. This option allows you to choose an adapter from a list of the most used relational databases. You can even run the generator repeatedly: `cd .. && rails new blog --database=mysql`. When you confirm the overwriting of the `config/database.yml` file, your application will be configured for MySQL instead of SQLite. Detailed examples of the common database connections are below.
+TIP: You don't have to update the database configurations manually. If you look at the options of the application generator, you will see that one of the options is named `--database`. This option allows you to choose an adapter from a list of the most used relational databases. You can even run the generator repeatedly: `cd .. && rails new blog --database=mysql`. When you confirm the overwriting of the `config/database.yml` file, your application will be configured for MySQL instead of SQLite. Detailed examples of the common database connections are below.
#### Configuring an SQLite3 Database
@@ -530,7 +530,7 @@ By default Rails ships with three environments: "development", "test", and "prod
Imagine you have a server which mirrors the production environment but is only used for testing. Such a server is commonly called a "staging server". To define an environment called "staging" for this server just by create a file called `config/environments/staging.rb`. Please use the contents of any existing file in `config/environments` as a starting point and make the necessary changes from there.
-That environment is no different than the default ones, start a server with `rails server -e staging`, a console with `rails console staging`, `Rails.env.staging?` works, etc.
+That environment is no different than the default ones, start a server with `rails server -e staging`, a console with `rails console staging`, `Rails.env.staging?` works, etc.
Rails Environment Settings
diff --git a/guides/source/getting_started.md b/guides/source/getting_started.md
index 34590fefa5..beb51c7161 100644
--- a/guides/source/getting_started.md
+++ b/guides/source/getting_started.md
@@ -135,7 +135,7 @@ application. Most of the work in this tutorial will happen in the `app/` folder,
| ----------- | ------- |
|app/|Contains the controllers, models, views, helpers, mailers and assets for your application. You'll focus on this folder for the remainder of this guide.|
|bin/|Contains the rails script that starts your app and can contain other scripts you use to deploy or run your application.|
-|config/|Configure your application's runtime rules, routes, database, and more. This is covered in more detail in [Configuring Rails Applications](configuring.html)|
+|config/|Configure your application's runtime rules, routes, database, and more. This is covered in more detail in [Configuring Rails Applications](configuring.html)|
|config.ru|Rack configuration for Rack based servers used to start the application.|
|db/|Contains your current database schema, as well as the database migrations.|
|Gemfile
Gemfile.lock|These files allow you to specify what gem dependencies are needed for your Rails application. These files are used by the Bundler gem. For more information about Bundler, see [the Bundler website](http://gembundler.com) |
@@ -288,7 +288,7 @@ It will look a little basic for now, but that's ok. We'll look at improving the
### Laying down the ground work
-The first thing that you are going to need to create a new post within the application is a place to do that. A great place for that would be at `/posts/new`. With the route already defined, requests can now be made to `/posts/new` in the application. Navigate to and you'll see a routing error:
+The first thing that you are going to need to create a new post within the application is a place to do that. A great place for that would be at `/posts/new`. With the route already defined, requests can now be made to `/posts/new` in the application. Navigate to and you'll see a routing error:

@@ -742,7 +742,7 @@ end
```
These changes will ensure that all posts have a title that is at least five
-characters long. Rails can validate a variety of conditions in a model,
+characters long. Rails can validate a variety of conditions in a model,
including the presence or uniqueness of columns, their format, and the
existence of associated objects. Validations are covered in detail in [Active
Record Validations](active_record_validations.html)
diff --git a/guides/source/routing.md b/guides/source/routing.md
index c26a827172..076b9dd176 100644
--- a/guides/source/routing.md
+++ b/guides/source/routing.md
@@ -36,7 +36,7 @@ the request is dispatched to the `patients` controller's `show` action with `{ i
### Generating Paths and URLs from Code
-You can also generate paths and URLs. If the route above is modified to be:
+You can also generate paths and URLs. If the route above is modified to be:
```ruby
get '/patients/:id', to: 'patients#show', as: 'patient'
@@ -803,7 +803,7 @@ You should put the `root` route at the top of the file, because it is the most p
NOTE: The `root` route only routes `GET` requests to the action.
-You can also use root inside namespaces and scopes as well. For example:
+You can also use root inside namespaces and scopes as well. For example:
```ruby
namespace :admin do
diff --git a/guides/source/testing.md b/guides/source/testing.md
index e33e5d9783..b8aec94386 100644
--- a/guides/source/testing.md
+++ b/guides/source/testing.md
@@ -64,7 +64,7 @@ YAML-formatted fixtures are a very human-friendly way to describe your sample da
Here's a sample YAML fixture file:
```yaml
-# lo & behold! I am a YAML comment!
+# lo & behold! I am a YAML comment!
david:
name: David Heinemeier Hansson
birthday: 1979-10-15
@@ -396,7 +396,7 @@ Rails adds some custom assertions of its own to the `test/unit` framework:
| `assert_no_difference(expressions, message = nil, &block)` | Asserts that the numeric result of evaluating an expression is not changed before and after invoking the passed in block.|
| `assert_recognizes(expected_options, path, extras={}, message=nil)` | Asserts that the routing of the given path was handled correctly and that the parsed options (given in the expected_options hash) match path. Basically, it asserts that Rails recognizes the route given by expected_options.|
| `assert_generates(expected_path, options, defaults={}, extras = {}, message=nil)` | Asserts that the provided options can be used to generate the provided path. This is the inverse of assert_recognizes. The extras parameter is used to tell the request the names and values of additional request parameters that would be in a query string. The message parameter allows you to specify a custom error message for assertion failures.|
-| `assert_response(type, message = nil)` | Asserts that the response comes with a specific status code. You can specify `:success` to indicate 200-299, `:redirect` to indicate 300-399, `:missing` to indicate 404, or `:error` to match the 500-599 range|
+| `assert_response(type, message = nil)` | Asserts that the response comes with a specific status code. You can specify `:success` to indicate 200-299, `:redirect` to indicate 300-399, `:missing` to indicate 404, or `:error` to match the 500-599 range|
| `assert_redirected_to(options = {}, message=nil)` | Assert that the redirection options passed in match those of the redirect called in the latest action. This match can be partial, such that `assert_redirected_to(controller: "weblog")` will also match the redirection of `redirect_to(controller: "weblog", action: "show")` and so on.|
| `assert_template(expected = nil, message=nil)` | Asserts that the request was rendered with the appropriate template file.|
diff --git a/guides/source/upgrading_ruby_on_rails.md b/guides/source/upgrading_ruby_on_rails.md
index 694592a9de..3d9c2b8318 100644
--- a/guides/source/upgrading_ruby_on_rails.md
+++ b/guides/source/upgrading_ruby_on_rails.md
@@ -34,7 +34,7 @@ resources :users
the action in `UsersController` to update a user is still `update`.
`PUT` requests to `/users/:id` in Rails 4 get routed to `update` as they are
-today. So, if you have an API that gets real PUT requests it is going to work.
+today. So, if you have an API that gets real PUT requests it is going to work.
The router also routes `PATCH` requests to `/users/:id` to the `update` action.
So, in Rails 4 both `PUT` and `PATCH` are routed to update. We recommend
--
cgit v1.2.3
From 70b302b189dbe9f90e3b081fa540c909a43ba8d0 Mon Sep 17 00:00:00 2001
From: Sunny Ripert
Date: Tue, 28 May 2013 14:36:18 +0200
Subject: Remove double spaces in code examples
---
guides/source/2_3_release_notes.md | 4 ++--
guides/source/active_record_querying.md | 2 +-
guides/source/form_helpers.md | 2 +-
guides/source/i18n.md | 2 +-
guides/source/initialization.md | 10 +++++-----
guides/source/migrations.md | 2 +-
guides/source/rails_on_rack.md | 2 +-
7 files changed, 12 insertions(+), 12 deletions(-)
(limited to 'guides/source')
diff --git a/guides/source/2_3_release_notes.md b/guides/source/2_3_release_notes.md
index 3c08f148cf..73be6254ab 100644
--- a/guides/source/2_3_release_notes.md
+++ b/guides/source/2_3_release_notes.md
@@ -173,8 +173,8 @@ before_save :update_credit_rating, :if => :active,
Rails now has a `:having` option on find (as well as on `has_many` and `has_and_belongs_to_many` associations) for filtering records in grouped finds. As those with heavy SQL backgrounds know, this allows filtering based on grouped results:
```ruby
-developers = Developer.find(:all, :group => "salary",
- :having => "sum(salary) > 10000", :select => "salary")
+developers = Developer.find(:all, :group => "salary",
+ :having => "sum(salary) > 10000", :select => "salary")
```
* Lead Contributor: [Emilio Tagua](http://github.com/miloops)
diff --git a/guides/source/active_record_querying.md b/guides/source/active_record_querying.md
index 5e1fdc78a5..69070eea21 100644
--- a/guides/source/active_record_querying.md
+++ b/guides/source/active_record_querying.md
@@ -1229,7 +1229,7 @@ One important caveat is that `default_scope` will be overridden by
```ruby
class User < ActiveRecord::Base
- default_scope { where state: 'pending' }
+ default_scope { where state: 'pending' }
scope :active, -> { where state: 'active' }
scope :inactive, -> { where state: 'inactive' }
end
diff --git a/guides/source/form_helpers.md b/guides/source/form_helpers.md
index a4dab39d55..7e18387a82 100644
--- a/guides/source/form_helpers.md
+++ b/guides/source/form_helpers.md
@@ -885,7 +885,7 @@ end
:name => 'John Doe',
:addresses_attributes => {
'0' => {
- :kind => 'Home',
+ :kind => 'Home',
:street => '221b Baker Street',
},
'1' => {
diff --git a/guides/source/i18n.md b/guides/source/i18n.md
index 65a85efa69..b248c7645a 100644
--- a/guides/source/i18n.md
+++ b/guides/source/i18n.md
@@ -174,7 +174,7 @@ end
# in your /etc/hosts file to try this out locally
def extract_locale_from_tld
parsed_locale = request.host.split('.').last
- I18n.available_locales.include?(parsed_locale.to_sym) ? parsed_locale : nil
+ I18n.available_locales.include?(parsed_locale.to_sym) ? parsed_locale : nil
end
```
diff --git a/guides/source/initialization.md b/guides/source/initialization.md
index 9fcd530183..738591659d 100644
--- a/guides/source/initialization.md
+++ b/guides/source/initialization.md
@@ -36,8 +36,8 @@ This file is as follows:
```ruby
#!/usr/bin/env ruby
-APP_PATH = File.expand_path('../../config/application', __FILE__)
-require File.expand_path('../../config/boot', __FILE__)
+APP_PATH = File.expand_path('../../config/application', __FILE__)
+require File.expand_path('../../config/boot', __FILE__)
require 'rails/commands'
```
@@ -373,7 +373,7 @@ The `options[:config]` value defaults to `config.ru` which contains this:
```ruby
# This file is used by Rack-based servers to start the application.
-require ::File.expand_path('../config/environment', __FILE__)
+require ::File.expand_path('../config/environment', __FILE__)
run <%= app_const %>
```
@@ -388,7 +388,7 @@ app = eval "Rack::Builder.new {( " + cfgfile + "\n )}.to_app",
The `initialize` method of `Rack::Builder` will take the block here and execute it within an instance of `Rack::Builder`. This is where the majority of the initialization process of Rails happens. The `require` line for `config/environment.rb` in `config.ru` is the first to run:
```ruby
-require ::File.expand_path('../config/environment', __FILE__)
+require ::File.expand_path('../config/environment', __FILE__)
```
### `config/environment.rb`
@@ -546,7 +546,7 @@ def self.run(app, options={})
else
server.register('/', Rack::Handler::Mongrel.new(app))
end
- yield server if block_given?
+ yield server if block_given?
server.run.join
end
```
diff --git a/guides/source/migrations.md b/guides/source/migrations.md
index 1ad8db12eb..ae0726c559 100644
--- a/guides/source/migrations.md
+++ b/guides/source/migrations.md
@@ -877,7 +877,7 @@ end
# app/models/product.rb
class Product < ActiveRecord::Base
- validates :flag, inclusion: { in: [true, false] }
+ validates :flag, inclusion: { in: [true, false] }
validates :fuzz, presence: true
end
```
diff --git a/guides/source/rails_on_rack.md b/guides/source/rails_on_rack.md
index de8f3f483f..4b77892dd3 100644
--- a/guides/source/rails_on_rack.md
+++ b/guides/source/rails_on_rack.md
@@ -82,7 +82,7 @@ To use `rackup` instead of Rails' `rails server`, you can put the following insi
```ruby
# Rails.root/config.ru
-require ::File.expand_path('../config/environment', __FILE__)
+require ::File.expand_path('../config/environment', __FILE__)
use Rack::Debugger
use Rack::ContentLength
--
cgit v1.2.3
From 53607be559ec60e3b5bd915f8533550648f7ef8a Mon Sep 17 00:00:00 2001
From: Sunny Ripert
Date: Tue, 28 May 2013 14:37:04 +0200
Subject: Remove double spaces in guides
---
guides/source/action_mailer_basics.md | 2 +-
guides/source/active_record_validations.md | 2 +-
guides/source/api_documentation_guidelines.md | 2 +-
guides/source/caching_with_rails.md | 2 +-
guides/source/form_helpers.md | 4 ++--
guides/source/migrations.md | 2 +-
guides/source/security.md | 4 ++--
guides/source/testing.md | 10 +++++-----
8 files changed, 14 insertions(+), 14 deletions(-)
(limited to 'guides/source')
diff --git a/guides/source/action_mailer_basics.md b/guides/source/action_mailer_basics.md
index 1f3f2a933e..df7ea7382e 100644
--- a/guides/source/action_mailer_basics.md
+++ b/guides/source/action_mailer_basics.md
@@ -623,7 +623,7 @@ files (environment.rb, production.rb, etc...)
| Configuration | Description |
|---------------|-------------|
|`logger`|Generates information on the mailing run if available. Can be set to `nil` for no logging. Compatible with both Ruby's own `Logger` and `Log4r` loggers.|
-|`smtp_settings`|Allows detailed configuration for `:smtp` delivery method:- `:address` - Allows you to use a remote mail server. Just change it from its default "localhost" setting.
- `:port` - On the off chance that your mail server doesn't run on port 25, you can change it.
- `:domain` - If you need to specify a HELO domain, you can do it here.
- `:user_name` - If your mail server requires authentication, set the username in this setting.
- `:password` - If your mail server requires authentication, set the password in this setting.
- `:authentication` - If your mail server requires authentication, you need to specify the authentication type here. This is a symbol and one of `:plain`, `:login`, `:cram_md5`.
- `:enable_starttls_auto` - Set this to `false` if there is a problem with your server certificate that you cannot resolve.
|
+|`smtp_settings`|Allows detailed configuration for `:smtp` delivery method:- `:address` - Allows you to use a remote mail server. Just change it from its default "localhost" setting.
- `:port` - On the off chance that your mail server doesn't run on port 25, you can change it.
- `:domain` - If you need to specify a HELO domain, you can do it here.
- `:user_name` - If your mail server requires authentication, set the username in this setting.
- `:password` - If your mail server requires authentication, set the password in this setting.
- `:authentication` - If your mail server requires authentication, you need to specify the authentication type here. This is a symbol and one of `:plain`, `:login`, `:cram_md5`.
- `:enable_starttls_auto` - Set this to `false` if there is a problem with your server certificate that you cannot resolve.
|
|`sendmail_settings`|Allows you to override options for the `:sendmail` delivery method.- `:location` - The location of the sendmail executable. Defaults to `/usr/sbin/sendmail`.
- `:arguments` - The command line arguments to be passed to sendmail. Defaults to `-i -t`.
|
|`raise_delivery_errors`|Whether or not errors should be raised if the email fails to be delivered. This only works if the external email server is configured for immediate delivery.|
|`delivery_method`|Defines a delivery method. Possible values are `:smtp` (default), `:sendmail`, `:file` and `:test`.|
diff --git a/guides/source/active_record_validations.md b/guides/source/active_record_validations.md
index ebf4e58444..e155a2f7b3 100644
--- a/guides/source/active_record_validations.md
+++ b/guides/source/active_record_validations.md
@@ -243,7 +243,7 @@ line of code you can add the same kind of validation to several attributes.
All of them accept the `:on` and `:message` options, which define when the
validation should be run and what message should be added to the `errors`
collection if it fails, respectively. The `:on` option takes one of the values
-`:save` (the default), `:create` or `:update`. There is a default error
+`:save` (the default), `:create` or `:update`. There is a default error
message for each one of the validation helpers. These messages are used when
the `:message` option isn't specified. Let's take a look at each one of the
available helpers.
diff --git a/guides/source/api_documentation_guidelines.md b/guides/source/api_documentation_guidelines.md
index d2fdbc7ac0..7e056d970c 100644
--- a/guides/source/api_documentation_guidelines.md
+++ b/guides/source/api_documentation_guidelines.md
@@ -141,7 +141,7 @@ class Array
end
```
-WARNING: Using a pair of `+...+` for fixed-width font only works with **words**; that is: anything matching `\A\w+\z`. For anything else use `...`, notably symbols, setters, inline snippets, etc.
+WARNING: Using a pair of `+...+` for fixed-width font only works with **words**; that is: anything matching `\A\w+\z`. For anything else use `...`, notably symbols, setters, inline snippets, etc.
### Regular Font
diff --git a/guides/source/caching_with_rails.md b/guides/source/caching_with_rails.md
index 456abaf612..c0cbce81c5 100644
--- a/guides/source/caching_with_rails.md
+++ b/guides/source/caching_with_rails.md
@@ -236,7 +236,7 @@ config.cache_store = :ehcache_store
When initializing the cache, you may use the `:ehcache_config` option to specify the Ehcache config file to use (where the default is "ehcache.xml" in your Rails config directory), and the :cache_name option to provide a custom name for your cache (the default is rails_cache).
-In addition to the standard `:expires_in` option, the `write` method on this cache can also accept the additional `:unless_exist` option, which will cause the cache store to use Ehcache's `putIfAbsent` method instead of `put`, and therefore will not overwrite an existing entry. Additionally, the `write` method supports all of the properties exposed by the [Ehcache Element class](http://ehcache.org/apidocs/net/sf/ehcache/Element.html) , including:
+In addition to the standard `:expires_in` option, the `write` method on this cache can also accept the additional `:unless_exist` option, which will cause the cache store to use Ehcache's `putIfAbsent` method instead of `put`, and therefore will not overwrite an existing entry. Additionally, the `write` method supports all of the properties exposed by the [Ehcache Element class](http://ehcache.org/apidocs/net/sf/ehcache/Element.html) , including:
| Property | Argument Type | Description |
| --------------------------- | ------------------- | ----------------------------------------------------------- |
diff --git a/guides/source/form_helpers.md b/guides/source/form_helpers.md
index 7e18387a82..b409534cb0 100644
--- a/guides/source/form_helpers.md
+++ b/guides/source/form_helpers.md
@@ -568,7 +568,7 @@ NOTE: In many cases the built-in date pickers are clumsy as they do not aid the
### Individual Components
-Occasionally you need to display just a single date component such as a year or a month. Rails provides a series of helpers for this, one for each component `select_year`, `select_month`, `select_day`, `select_hour`, `select_minute`, `select_second`. These helpers are fairly straightforward. By default they will generate an input field named after the time component (for example "year" for `select_year`, "month" for `select_month` etc.) although this can be overridden with the `:field_name` option. The `:prefix` option works in the same way that it does for `select_date` and `select_time` and has the same default value.
+Occasionally you need to display just a single date component such as a year or a month. Rails provides a series of helpers for this, one for each component `select_year`, `select_month`, `select_day`, `select_hour`, `select_minute`, `select_second`. These helpers are fairly straightforward. By default they will generate an input field named after the time component (for example "year" for `select_year`, "month" for `select_month` etc.) although this can be overridden with the `:field_name` option. The `:prefix` option works in the same way that it does for `select_date` and `select_time` and has the same default value.
The first parameter specifies which value should be selected and can either be an instance of a Date, Time or DateTime, in which case the relevant component will be extracted, or a numerical value. For example
@@ -830,7 +830,7 @@ Many apps grow beyond simple forms editing a single object. For example when cre
### Configuring the Model
-Active Record provides model level support via the `accepts_nested_attributes_for` method:
+Active Record provides model level support via the `accepts_nested_attributes_for` method:
```ruby
class Person < ActiveRecord::Base
diff --git a/guides/source/migrations.md b/guides/source/migrations.md
index ae0726c559..194ae276ec 100644
--- a/guides/source/migrations.md
+++ b/guides/source/migrations.md
@@ -448,7 +448,7 @@ definitions:
* `create_table`
* `create_join_table`
* `drop_table` (must supply a block)
-* `drop_join_table` (must supply a block)
+* `drop_join_table` (must supply a block)
* `remove_timestamps`
* `rename_column`
* `rename_index`
diff --git a/guides/source/security.md b/guides/source/security.md
index f04129acdb..ad0546810d 100644
--- a/guides/source/security.md
+++ b/guides/source/security.md
@@ -346,13 +346,13 @@ Intranet and administration interfaces are popular attack targets, because they
In 2007 there was the first tailor-made trojan which stole information from an Intranet, namely the "Monster for employers" web site of Monster.com, an online recruitment web application. Tailor-made Trojans are very rare, so far, and the risk is quite low, but it is certainly a possibility and an example of how the security of the client host is important, too. However, the highest threat to Intranet and Admin applications are XSS and CSRF.
-**XSS** If your application re-displays malicious user input from the extranet, the application will be vulnerable to XSS. User names, comments, spam reports, order addresses are just a few uncommon examples, where there can be XSS.
+**XSS** If your application re-displays malicious user input from the extranet, the application will be vulnerable to XSS. User names, comments, spam reports, order addresses are just a few uncommon examples, where there can be XSS.
Having one single place in the admin interface or Intranet, where the input has not been sanitized, makes the entire application vulnerable. Possible exploits include stealing the privileged administrator's cookie, injecting an iframe to steal the administrator's password or installing malicious software through browser security holes to take over the administrator's computer.
Refer to the Injection section for countermeasures against XSS. It is _recommended to use the SafeErb plugin_ also in an Intranet or administration interface.
-**CSRF** Cross-Site Reference Forgery (CSRF) is a gigantic attack method, it allows the attacker to do everything the administrator or Intranet user may do. As you have already seen above how CSRF works, here are a few examples of what attackers can do in the Intranet or admin interface.
+**CSRF** Cross-Site Reference Forgery (CSRF) is a gigantic attack method, it allows the attacker to do everything the administrator or Intranet user may do. As you have already seen above how CSRF works, here are a few examples of what attackers can do in the Intranet or admin interface.
A real-world example is a [router reconfiguration by CSRF](http://www.h-online.com/security/Symantec-reports-first-active-attack-on-a-DSL-router--/news/102352). The attackers sent a malicious e-mail, with CSRF in it, to Mexican users. The e-mail claimed there was an e-card waiting for them, but it also contained an image tag that resulted in a HTTP-GET request to reconfigure the user's router (which is a popular model in Mexico). The request changed the DNS-settings so that requests to a Mexico-based banking site would be mapped to the attacker's site. Everyone who accessed the banking site through that router saw the attacker's fake web site and had his credentials stolen.
diff --git a/guides/source/testing.md b/guides/source/testing.md
index b8aec94386..fbda1e8f45 100644
--- a/guides/source/testing.md
+++ b/guides/source/testing.md
@@ -622,11 +622,11 @@ The `assert_select` assertion is quite powerful. For more advanced usage, refer
There are more assertions that are primarily used in testing views:
-| Assertion | Purpose |
-| ---------------------------------------------------------- | ------- |
-| `assert_select_email` | Allows you to make assertions on the body of an e-mail. |
-| `assert_select_encoded` | Allows you to make assertions on encoded HTML. It does this by un-encoding the contents of each element and then calling the block with all the un-encoded elements.|
-| `css_select(selector)` or `css_select(element, selector)` | Returns an array of all the elements selected by the _selector_. In the second variant it first matches the base _element_ and tries to match the _selector_ expression on any of its children. If there are no matches both variants return an empty array.|
+| Assertion | Purpose |
+| --------------------------------------------------------- | ------- |
+| `assert_select_email` | Allows you to make assertions on the body of an e-mail. |
+| `assert_select_encoded` | Allows you to make assertions on encoded HTML. It does this by un-encoding the contents of each element and then calling the block with all the un-encoded elements.|
+| `css_select(selector)` or `css_select(element, selector)` | Returns an array of all the elements selected by the _selector_. In the second variant it first matches the base _element_ and tries to match the _selector_ expression on any of its children. If there are no matches both variants return an empty array.|
Here's an example of using `assert_select_email`:
--
cgit v1.2.3
From 2478b5e619fb8714755480429eba85eef93cbed7 Mon Sep 17 00:00:00 2001
From: Sunny Ripert
Date: Tue, 28 May 2013 14:11:40 +0200
Subject: Remove references to deprecated test tasks
---
guides/source/testing.md | 7 -------
1 file changed, 7 deletions(-)
(limited to 'guides/source')
diff --git a/guides/source/testing.md b/guides/source/testing.md
index fbda1e8f45..95d454ba9d 100644
--- a/guides/source/testing.md
+++ b/guides/source/testing.md
@@ -778,13 +778,6 @@ You don't need to set up and run your tests by hand on a test-by-test basis. Rai
| `rake test:models` | Runs all the model tests from `test/models`|
| `rake test:units` | Runs all the unit tests from `test/models`, `test/helpers`, and `test/unit`|
-There're also some test commands which you can initiate by running rake tasks:
-
-| Tasks | Description |
-| ------------------------ | ----------- |
-| `rake test` | Runs all unit, functional and integration tests. You can also simply run `rake` as the _test_ target is the default.|
-| `rake test:recent` | Tests recent changes|
-| `rake test:uncommitted` | Runs all the tests which are uncommitted. Supports Subversion and Git|
Brief Note About `MiniTest`
-----------------------------
--
cgit v1.2.3
From 84675cae63093c529f3a2c3f7e545891fecc08aa Mon Sep 17 00:00:00 2001
From: Sunny Ripert
Date: Tue, 28 May 2013 15:02:31 +0200
Subject: Consistent one-spaced bullets in guides release notes
---
guides/source/2_3_release_notes.md | 2 +-
guides/source/4_0_release_notes.md | 57 +++++++++++++++++++-------------------
2 files changed, 29 insertions(+), 30 deletions(-)
(limited to 'guides/source')
diff --git a/guides/source/2_3_release_notes.md b/guides/source/2_3_release_notes.md
index 73be6254ab..0f05cc6b85 100644
--- a/guides/source/2_3_release_notes.md
+++ b/guides/source/2_3_release_notes.md
@@ -40,7 +40,7 @@ Here's a summary of the rack-related changes:
* `ActiveRecord::QueryCache` middleware is automatically inserted onto the middleware stack if `ActiveRecord` has been loaded. This middleware sets up and flushes the per-request Active Record query cache.
* The Rails router and controller classes follow the Rack spec. You can call a controller directly with `SomeController.call(env)`. The router stores the routing parameters in `rack.routing_args`.
* `ActionController::Request` inherits from `Rack::Request`.
-* Instead of `config.action_controller.session = { :session_key => 'foo', ...` use `config.action_controller.session = { :key => 'foo', ...`.
+* Instead of `config.action_controller.session = { :session_key => 'foo', ...` use `config.action_controller.session = { :key => 'foo', ...`.
* Using the `ParamsParser` middleware preprocesses any XML, JSON, or YAML requests so they can be read normally with any `Rack::Request` object after it.
### Renewed Support for Rails Engines
diff --git a/guides/source/4_0_release_notes.md b/guides/source/4_0_release_notes.md
index 840dd049a7..6ebeeed0bf 100644
--- a/guides/source/4_0_release_notes.md
+++ b/guides/source/4_0_release_notes.md
@@ -83,7 +83,7 @@ Please refer to the [Changelog](https://github.com/rails/rails/blob/master/railt
### Notable changes
-* New test locations `test/models`, `test/helpers`, `test/controllers`, and `test/mailers`. Corresponding rake tasks added as well. ([Pull Request](https://github.com/rails/rails/pull/7878))
+* New test locations `test/models`, `test/helpers`, `test/controllers`, and `test/mailers`. Corresponding rake tasks added as well. ([Pull Request](https://github.com/rails/rails/pull/7878))
* Your app's executables now live in the `bin/` directory. Run `rake rails:update:bin` to get `bin/bundle`, `bin/rails`, and `bin/rake`.
@@ -111,10 +111,9 @@ Please refer to the [Changelog](https://github.com/rails/rails/blob/master/activ
### Notable changes
-* Add `ActiveModel::ForbiddenAttributesProtection`, a simple module to protect attributes from mass assignment when non-permitted attributes are passed.
+* Add `ActiveModel::ForbiddenAttributesProtection`, a simple module to protect attributes from mass assignment when non-permitted attributes are passed.
-* Added `ActiveModel::Model`, a mixin to make Ruby objects work with
- Action Pack out of box.
+* Added `ActiveModel::Model`, a mixin to make Ruby objects work with Action Pack out of box.
### Deprecations
@@ -125,27 +124,27 @@ Please refer to the [Changelog](https://github.com/rails/rails/blob/master/activ
### Notable changes
-* Replace deprecated `memcache-client` gem with `dalli` in ActiveSupport::Cache::MemCacheStore.
+* Replace deprecated `memcache-client` gem with `dalli` in ActiveSupport::Cache::MemCacheStore.
-* Optimize ActiveSupport::Cache::Entry to reduce memory and processing overhead.
+* Optimize ActiveSupport::Cache::Entry to reduce memory and processing overhead.
-* Inflections can now be defined per locale. `singularize` and `pluralize` accept locale as an extra argument.
+* Inflections can now be defined per locale. `singularize` and `pluralize` accept locale as an extra argument.
-* `Object#try` will now return nil instead of raise a NoMethodError if the receiving object does not implement the method, but you can still get the old behavior by using the new `Object#try!`.
+* `Object#try` will now return nil instead of raise a NoMethodError if the receiving object does not implement the method, but you can still get the old behavior by using the new `Object#try!`.
### Deprecations
-* Deprecate `ActiveSupport::TestCase#pending` method, use `skip` from MiniTest instead.
+* Deprecate `ActiveSupport::TestCase#pending` method, use `skip` from MiniTest instead.
-* ActiveSupport::Benchmarkable#silence has been deprecated due to its lack of thread safety. It will be removed without replacement in Rails 4.1.
+* ActiveSupport::Benchmarkable#silence has been deprecated due to its lack of thread safety. It will be removed without replacement in Rails 4.1.
-* `ActiveSupport::JSON::Variable` is deprecated. Define your own `#as_json` and `#encode_json` methods for custom JSON string literals.
+* `ActiveSupport::JSON::Variable` is deprecated. Define your own `#as_json` and `#encode_json` methods for custom JSON string literals.
-* Deprecates the compatibility method Module#local_constant_names, use Module#local_constants instead (which returns symbols).
+* Deprecates the compatibility method Module#local_constant_names, use Module#local_constants instead (which returns symbols).
-* BufferedLogger is deprecated. Use ActiveSupport::Logger, or the logger from Ruby standard library.
+* BufferedLogger is deprecated. Use ActiveSupport::Logger, or the logger from Ruby standard library.
-* Deprecate `assert_present` and `assert_blank` in favor of `assert object.blank?` and `assert object.present?`
+* Deprecate `assert_present` and `assert_blank` in favor of `assert object.blank?` and `assert object.present?`
Action Pack
-----------
@@ -166,7 +165,7 @@ Please refer to the [Changelog](https://github.com/rails/rails/blob/master/activ
### Notable changes
-* Improve ways to write `change` migrations, making the old `up` & `down` methods no longer necessary.
+* Improve ways to write `change` migrations, making the old `up` & `down` methods no longer necessary.
* The methods `drop_table` and `remove_column` are now reversible, as long as the necessary information is given.
The method `remove_column` used to accept multiple column names; instead use `remove_columns` (which is not revertible).
@@ -179,36 +178,36 @@ Please refer to the [Changelog](https://github.com/rails/rails/blob/master/activ
If migrating down, the given migration / block is run normally.
See the [Guide on Migration](https://github.com/rails/rails/blob/master/guides/source/migrations.md#reverting-previous-migrations)
-* Adds PostgreSQL array type support. Any datatype can be used to create an array column, with full migration and schema dumper support.
+* Adds PostgreSQL array type support. Any datatype can be used to create an array column, with full migration and schema dumper support.
-* Add `Relation#load` to explicitly load the record and return `self`.
+* Add `Relation#load` to explicitly load the record and return `self`.
-* `Model.all` now returns an `ActiveRecord::Relation`, rather than an array of records. Use `Relation#to_a` if you really want an array. In some specific cases, this may cause breakage when upgrading.
+* `Model.all` now returns an `ActiveRecord::Relation`, rather than an array of records. Use `Relation#to_a` if you really want an array. In some specific cases, this may cause breakage when upgrading.
-* Added `ActiveRecord::Migration.check_pending!` that raises an error if migrations are pending.
+* Added `ActiveRecord::Migration.check_pending!` that raises an error if migrations are pending.
-* Added custom coders support for `ActiveRecord::Store`. Now you can set your custom coder like this:
+* Added custom coders support for `ActiveRecord::Store`. Now you can set your custom coder like this:
store :settings, accessors: [ :color, :homepage ], coder: JSON
-* `mysql` and `mysql2` connections will set `SQL_MODE=STRICT_ALL_TABLES` by default to avoid silent data loss. This can be disabled by specifying `strict: false` in your `database.yml`.
+* `mysql` and `mysql2` connections will set `SQL_MODE=STRICT_ALL_TABLES` by default to avoid silent data loss. This can be disabled by specifying `strict: false` in your `database.yml`.
-* Remove IdentityMap.
+* Remove IdentityMap.
-* Remove automatic execution of EXPLAIN queries. The option `active_record.auto_explain_threshold_in_seconds` is no longer used and should be removed.
+* Remove automatic execution of EXPLAIN queries. The option `active_record.auto_explain_threshold_in_seconds` is no longer used and should be removed.
-* Adds `ActiveRecord::NullRelation` and `ActiveRecord::Relation#none` implementing the null object pattern for the Relation class.
+* Adds `ActiveRecord::NullRelation` and `ActiveRecord::Relation#none` implementing the null object pattern for the Relation class.
-* Added `create_join_table` migration helper to create HABTM join tables.
+* Added `create_join_table` migration helper to create HABTM join tables.
-* Allows PostgreSQL hstore records to be created.
+* Allows PostgreSQL hstore records to be created.
### Deprecations
-* Deprecated the old-style hash based finder API. This means that methods which previously accepted "finder options" no longer do.
+* Deprecated the old-style hash based finder API. This means that methods which previously accepted "finder options" no longer do.
-* All dynamic methods except for `find_by_...` and `find_by_...!` are deprecated. Here's
- how you can rewrite the code:
+* All dynamic methods except for `find_by_...` and `find_by_...!` are deprecated. Here's
+ how you can rewrite the code:
* `find_all_by_...` can be rewritten using `where(...)`.
* `find_last_by_...` can be rewritten using `where(...).last`.
--
cgit v1.2.3
From 91a1cf7013252753567b36f61bfcd5fd0a5bb2b8 Mon Sep 17 00:00:00 2001
From: Sunny Ripert
Date: Tue, 28 May 2013 15:03:14 +0200
Subject: Whitespace trimming in guides generation
---
guides/source/credits.html.erb | 4 ++--
guides/source/kindle/toc.ncx.erb | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
(limited to 'guides/source')
diff --git a/guides/source/credits.html.erb b/guides/source/credits.html.erb
index 10dd8178fb..8f546784ec 100644
--- a/guides/source/credits.html.erb
+++ b/guides/source/credits.html.erb
@@ -32,8 +32,8 @@ Ruby on Rails Guides: Credits
<% end %>
<%= author('Oscar Del Ben', 'oscardelben', 'oscardelben.jpg') do %>
-Oscar Del Ben is a software engineer at Wildfire. He's a regular open source contributor (GitHub account) and tweets regularly at @oscardelben.
- <% end %>
+ Oscar Del Ben is a software engineer at Wildfire. He's a regular open source contributor (GitHub account) and tweets regularly at @oscardelben.
+<% end %>
<%= author('Frederick Cheung', 'fcheung') do %>
Frederick Cheung is Chief Wizard at Texperts where he has been using Rails since 2006. He is based in Cambridge (UK) and when not consuming fine ales he blogs at spacevatican.org.
diff --git a/guides/source/kindle/toc.ncx.erb b/guides/source/kindle/toc.ncx.erb
index 2c6d8e3bdf..24ca6c88c9 100644
--- a/guides/source/kindle/toc.ncx.erb
+++ b/guides/source/kindle/toc.ncx.erb
@@ -37,7 +37,7 @@
Copyright & License
-
+
<% play_order = 4 %>
@@ -47,7 +47,7 @@
<%= section['name'] %>
-
+
<% section['documents'].each_with_index do |document, document_no| %>
--
cgit v1.2.3
From 6f30110cb400b847bc684a8e951ea1c4512bd2cd Mon Sep 17 00:00:00 2001
From: Kyle Fritz
Date: Wed, 29 May 2013 14:46:07 -0300
Subject: correct no-replay@example.com to no-reply@example.com
---
guides/source/action_mailer_basics.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'guides/source')
diff --git a/guides/source/action_mailer_basics.md b/guides/source/action_mailer_basics.md
index df7ea7382e..d1dd231cf6 100644
--- a/guides/source/action_mailer_basics.md
+++ b/guides/source/action_mailer_basics.md
@@ -649,7 +649,7 @@ config.action_mailer.delivery_method = :sendmail
# }
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true
-config.action_mailer.default_options = {from: 'no-replay@example.com'}
+config.action_mailer.default_options = {from: 'no-reply@example.com'}
```
### Action Mailer Configuration for Gmail
--
cgit v1.2.3
From 382419d28fe8c43b88e39b83ac175973a36feca8 Mon Sep 17 00:00:00 2001
From: RSL
Date: Thu, 30 May 2013 12:17:40 -0400
Subject: change additional 'RESTful' routes to 'resourceful' routes as the
additional actions may potentially get you farther away from RESTfulness
---
guides/source/routing.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'guides/source')
diff --git a/guides/source/routing.md b/guides/source/routing.md
index 076b9dd176..ecfb649257 100644
--- a/guides/source/routing.md
+++ b/guides/source/routing.md
@@ -461,7 +461,7 @@ For other actions, you just need to insert the action name as the first element
This allows you to treat instances of your models as URLs, and is a key advantage to using the resourceful style.
-### Adding More RESTful Actions
+### Adding More Resourceful Actions
You are not limited to the seven routes that RESTful routing creates by default. If you like, you may add additional routes that apply to the collection or individual members of the collection.
--
cgit v1.2.3
From 48ac592bd9d1b1fb9e069f005b084d535941240e Mon Sep 17 00:00:00 2001
From: RSL
Date: Thu, 30 May 2013 12:43:40 -0400
Subject: Revert "change additional 'RESTful' routes to 'resourceful' routes as
the additional actions may potentially get you farther away from RESTfulness"
This reverts commit 382419d28fe8c43b88e39b83ac175973a36feca8.
---
guides/source/routing.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'guides/source')
diff --git a/guides/source/routing.md b/guides/source/routing.md
index ecfb649257..076b9dd176 100644
--- a/guides/source/routing.md
+++ b/guides/source/routing.md
@@ -461,7 +461,7 @@ For other actions, you just need to insert the action name as the first element
This allows you to treat instances of your models as URLs, and is a key advantage to using the resourceful style.
-### Adding More Resourceful Actions
+### Adding More RESTful Actions
You are not limited to the seven routes that RESTful routing creates by default. If you like, you may add additional routes that apply to the collection or individual members of the collection.
--
cgit v1.2.3
From 861ec91e8c681302cec76d9bce278da829e85df1 Mon Sep 17 00:00:00 2001
From: Angelo capilleri
Date: Fri, 31 May 2013 17:59:06 +0200
Subject: add cache_if and cache_unless on caching doc
---
guides/source/caching_with_rails.md | 9 +++++++++
1 file changed, 9 insertions(+)
(limited to 'guides/source')
diff --git a/guides/source/caching_with_rails.md b/guides/source/caching_with_rails.md
index c0cbce81c5..1e196b0e42 100644
--- a/guides/source/caching_with_rails.md
+++ b/guides/source/caching_with_rails.md
@@ -104,6 +104,15 @@ This method generates a cache key that depends on all products and can be used i
All available products:
<% end %>
```
+
+If you want to cache a fragment under certain condition you can use `cache_if` or `cache_unless`
+
+```erb
+<% cache_if (condition, cache_key_for_products) do %>
+ All available products:
+<% end %>
+```
+
You can also use an Active Record model as the cache key:
```erb
--
cgit v1.2.3
From b9822cc354011c5c624ec5ac2db9eab2bdf5302e Mon Sep 17 00:00:00 2001
From: Graham Madden
Date: Fri, 31 May 2013 20:21:36 -0400
Subject: reword for grammar and clarity
---
guides/source/active_record_basics.md | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
(limited to 'guides/source')
diff --git a/guides/source/active_record_basics.md b/guides/source/active_record_basics.md
index fc8fac4651..42bb63700c 100644
--- a/guides/source/active_record_basics.md
+++ b/guides/source/active_record_basics.md
@@ -62,9 +62,9 @@ may be necessary to write a lot of configuration code. This is particularly true
for ORM frameworks in general. However, if you follow the conventions adopted by
Rails, you'll need to write very little configuration (in some case no
configuration at all) when creating Active Record models. The idea is that if
-you configure your applications in the very same way most of the times then this
-should be the default way. In this cases, explicit configuration would be needed
-only in those cases where you can't follow the conventions for any reason.
+you configure your applications in the very same way most of the time then this
+should be the default way. Thus, explicit configuration would be needed
+only in those cases where you can't follow the standar convention.
### Naming Conventions
--
cgit v1.2.3
From 6df9c595ad8e473d15a81a9291e891476bc833c2 Mon Sep 17 00:00:00 2001
From: Brian Fontenot
Date: Sat, 1 Jun 2013 00:27:24 -0500
Subject: Add detailed steps on how to squash multiple commits into a single
detailed commit
---
guides/source/contributing_to_ruby_on_rails.md | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
(limited to 'guides/source')
diff --git a/guides/source/contributing_to_ruby_on_rails.md b/guides/source/contributing_to_ruby_on_rails.md
index 0be9bb1ced..035db93a1a 100644
--- a/guides/source/contributing_to_ruby_on_rails.md
+++ b/guides/source/contributing_to_ruby_on_rails.md
@@ -325,6 +325,31 @@ You can also add bullet points:
TIP. Please squash your commits into a single commit when appropriate. This simplifies future cherry picks, and also keeps the git log clean.
+For example, to squash the previous three commits into one commit with a detailed commit message:
+
+```bash
+$ git rebase -i HEAD~3
+```
+
+Your editor will now open with the previous 3 commits listed:
+
+```
+pick 7ac1d4 description of first commit message
+pick 2b5aa3 description of second commit message
+pick da472c description of third commit message
+```
+
+Now squash the commits into the first commit
+
+```
+pick 7ac1d4 description of first commit message
+squash 2b5aa3 description of second commit message
+squash da472c description of third commit message
+```
+
+Ater saving and closing the editor, a new editor will open giving you the opportunity to write a detailed commit message for the newly squashed commit.
+
+
### Update Your Branch
It’s pretty likely that other changes to master have happened while you were working. Go get them:
--
cgit v1.2.3
From 38127d88e99db8022a9448ed403b9a50cef55d23 Mon Sep 17 00:00:00 2001
From: Rajarshi Das
Date: Thu, 6 Jun 2013 17:59:01 +0530
Subject: correction standr => standard of commits @0435d0e
---
guides/source/active_record_basics.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'guides/source')
diff --git a/guides/source/active_record_basics.md b/guides/source/active_record_basics.md
index 42bb63700c..1f25c6ae95 100644
--- a/guides/source/active_record_basics.md
+++ b/guides/source/active_record_basics.md
@@ -64,7 +64,7 @@ Rails, you'll need to write very little configuration (in some case no
configuration at all) when creating Active Record models. The idea is that if
you configure your applications in the very same way most of the time then this
should be the default way. Thus, explicit configuration would be needed
-only in those cases where you can't follow the standar convention.
+only in those cases where you can't follow the standard convention.
### Naming Conventions
--
cgit v1.2.3
From f8005de530fd73121046672435be49e714d528c6 Mon Sep 17 00:00:00 2001
From: Arun Agrawal
Date: Thu, 6 Jun 2013 23:32:31 +0200
Subject: As we have moved to rails/docrails from lifo/docrails
Changing links to guides.
We are not worried for old versions as GitHub is
handling the redirects.
---
guides/source/contributing_to_ruby_on_rails.md | 4 ++--
guides/source/getting_started.md | 2 +-
guides/source/layout.html.erb | 4 ++--
3 files changed, 5 insertions(+), 5 deletions(-)
(limited to 'guides/source')
diff --git a/guides/source/contributing_to_ruby_on_rails.md b/guides/source/contributing_to_ruby_on_rails.md
index 0be9bb1ced..0bfa646b81 100644
--- a/guides/source/contributing_to_ruby_on_rails.md
+++ b/guides/source/contributing_to_ruby_on_rails.md
@@ -182,9 +182,9 @@ Contributing to the Rails Documentation
Ruby on Rails has two main sets of documentation: the guides help you in learning about Ruby on Rails, and the API is a reference.
-You can help improve the Rails guides by making them more coherent, consistent or readable, adding missing information, correcting factual errors, fixing typos, or bringing it up to date with the latest edge Rails. To get involved in the translation of Rails guides, please see [Translating Rails Guides](https://wiki.github.com/lifo/docrails/translating-rails-guides).
+You can help improve the Rails guides by making them more coherent, consistent or readable, adding missing information, correcting factual errors, fixing typos, or bringing it up to date with the latest edge Rails. To get involved in the translation of Rails guides, please see [Translating Rails Guides](https://wiki.github.com/rails/docrails/translating-rails-guides).
-If you're confident about your changes, you can push them directly yourself via [docrails](https://github.com/lifo/docrails). Docrails is a branch with an **open commit policy** and public write access. Commits to docrails are still reviewed, but this happens after they are pushed. Docrails is merged with master regularly, so you are effectively editing the Ruby on Rails documentation.
+If you're confident about your changes, you can push them directly yourself via [docrails](https://github.com/rails/docrails). Docrails is a branch with an **open commit policy** and public write access. Commits to docrails are still reviewed, but this happens after they are pushed. Docrails is merged with master regularly, so you are effectively editing the Ruby on Rails documentation.
If you are unsure of the documentation changes, you can create an issue in the [Rails](https://github.com/rails/rails/issues) issues tracker on GitHub.
diff --git a/guides/source/getting_started.md b/guides/source/getting_started.md
index 599e47949d..1b30f4b728 100644
--- a/guides/source/getting_started.md
+++ b/guides/source/getting_started.md
@@ -64,7 +64,7 @@ Creating a New Rails Project
The best way to use this guide is to follow each step as it happens, no code or
step needed to make this example application has been left out, so you can
literally follow along step by step. You can get the complete code
-[here](https://github.com/lifo/docrails/tree/master/guides/code/getting_started).
+[here](https://github.com/rails/docrails/tree/master/guides/code/getting_started).
By following along with this guide, you'll create a Rails project called
`blog`, a
diff --git a/guides/source/layout.html.erb b/guides/source/layout.html.erb
index 397dd62638..ef2bdf0753 100644
--- a/guides/source/layout.html.erb
+++ b/guides/source/layout.html.erb
@@ -102,10 +102,10 @@
If you see any typos or factual errors you are confident to
- patch, please clone <%= link_to 'docrails', 'https://github.com/lifo/docrails' %>
+ patch, please clone <%= link_to 'docrails', 'https://github.com/rails/docrails' %>
and push the change yourself. That branch of Rails has public write access.
Commits are still reviewed, but that happens after you've submitted your
- contribution. <%= link_to 'docrails', 'https://github.com/lifo/docrails' %> is
+ contribution. <%= link_to 'docrails', 'https://github.com/rails/docrails' %> is
cross-merged with master periodically.
--
cgit v1.2.3
From f1d453b4fd3697c9b5bd9b130d4fd7cce6a776ad Mon Sep 17 00:00:00 2001
From: Matthew Hensrud
Date: Fri, 7 Jun 2013 17:37:02 -0400
Subject: Added bang method versions to association basics guide
---
guides/source/association_basics.md | 26 +++++++++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)
(limited to 'guides/source')
diff --git a/guides/source/association_basics.md b/guides/source/association_basics.md
index 04a77c3284..d7277b487f 100644
--- a/guides/source/association_basics.md
+++ b/guides/source/association_basics.md
@@ -721,6 +721,7 @@ When you declare a `belongs_to` association, the declaring class automatically g
* `association=(associate)`
* `build_association(attributes = {})`
* `create_association(attributes = {})`
+* `create_association!(attributes = {})`
In all of these methods, `association` is replaced with the symbol passed as the first argument to `belongs_to`. For example, given the declaration:
@@ -737,6 +738,7 @@ customer
customer=
build_customer
create_customer
+create_customer!
```
NOTE: When initializing a new `has_one` or `belongs_to` association you must use the `build_` prefix to build the association, rather than the `association.build` method that would be used for `has_many` or `has_and_belongs_to_many` associations. To create one, use the `create_` prefix.
@@ -777,6 +779,10 @@ The `create_association` method returns a new object of the associated type. Thi
customer_name: "John Doe")
```
+##### `create_association!(attributes = {})`
+
+Does the same as create_association above, but raises ActiveRecord::RecordInvalid if the record is invalid.
+
#### Options for `belongs_to`
@@ -1019,6 +1025,7 @@ When you declare a `has_one` association, the declaring class automatically gain
* `association=(associate)`
* `build_association(attributes = {})`
* `create_association(attributes = {})`
+* `create_association!(attributes = {})`
In all of these methods, `association` is replaced with the symbol passed as the first argument to `has_one`. For example, given the declaration:
@@ -1035,6 +1042,7 @@ account
account=
build_account
create_account
+create_account!
```
NOTE: When initializing a new `has_one` or `belongs_to` association you must use the `build_` prefix to build the association, rather than the `association.build` method that would be used for `has_many` or `has_and_belongs_to_many` associations. To create one, use the `create_` prefix.
@@ -1073,6 +1081,10 @@ The `create_association` method returns a new object of the associated type. Thi
@account = @supplier.create_account(terms: "Net 30")
```
+##### `create_association!(attributes = {})`
+
+Does the same as create_association above, but raises ActiveRecord::RecordInvalid if the record is invalid.
+
#### Options for `has_one`
While Rails uses intelligent defaults that will work well in most situations, there may be times when you want to customize the behavior of the `has_one` association reference. Such customizations can easily be accomplished by passing options when you create the association. For example, this association uses two such options:
@@ -1285,6 +1297,7 @@ When you declare a `has_many` association, the declaring class automatically gai
* `collection.exists?(...)`
* `collection.build(attributes = {}, ...)`
* `collection.create(attributes = {})`
+* `collection.create!(attributes = {})`
In all of these methods, `collection` is replaced with the symbol passed as the first argument to `has_many`, and `collection_singular` is replaced with the singularized version of that symbol. For example, given the declaration:
@@ -1312,6 +1325,7 @@ orders.where(...)
orders.exists?(...)
orders.build(attributes = {}, ...)
orders.create(attributes = {})
+orders.create!(attributes = {})
```
##### `collection(force_reload = false)`
@@ -1427,6 +1441,10 @@ The `collection.create` method returns a new object of the associated type. This
order_number: "A12345")
```
+##### `collection.create!(attributes = {})`
+
+Does the same as collection.create above, but raises ActiveRecord::RecordInvalid if the record is invalid.
+
#### Options for `has_many`
While Rails uses intelligent defaults that will work well in most situations, there may be times when you want to customize the behavior of the `has_many` association reference. Such customizations can easily be accomplished by passing options when you create the association. For example, this association uses two such options:
@@ -1768,6 +1786,7 @@ When you declare a `has_and_belongs_to_many` association, the declaring class au
* `collection.exists?(...)`
* `collection.build(attributes = {})`
* `collection.create(attributes = {})`
+* `collection.create!(attributes = {})`
In all of these methods, `collection` is replaced with the symbol passed as the first argument to `has_and_belongs_to_many`, and `collection_singular` is replaced with the singularized version of that symbol. For example, given the declaration:
@@ -1795,6 +1814,7 @@ assemblies.where(...)
assemblies.exists?(...)
assemblies.build(attributes = {}, ...)
assemblies.create(attributes = {})
+assemblies.create!(attributes = {})
```
##### Additional Column Methods
@@ -1914,6 +1934,10 @@ The `collection.create` method returns a new object of the associated type. This
@assembly = @part.assemblies.create({assembly_name: "Transmission housing"})
```
+##### `collection.create!(attributes = {})`
+
+Does the same as collection.create, but raises ActiveRecord::RecordInvalid if the record is invalid.
+
#### Options for `has_and_belongs_to_many`
While Rails uses intelligent defaults that will work well in most situations, there may be times when you want to customize the behavior of the `has_and_belongs_to_many` association reference. Such customizations can easily be accomplished by passing options when you create the association. For example, this association uses two such options:
@@ -2175,4 +2199,4 @@ Extensions can refer to the internals of the association proxy using these three
* `proxy_association.owner` returns the object that the association is a part of.
* `proxy_association.reflection` returns the reflection object that describes the association.
-* `proxy_association.target` returns the associated object for `belongs_to` or `has_one`, or the collection of associated objects for `has_many` or `has_and_belongs_to_many`.
+* `proxy_association.target` returns the associated object for `belongs_to` or `has_one`, or the collection of associated objects for `has_many` or `has_and_belongs_to_many`.
\ No newline at end of file
--
cgit v1.2.3
From 15f3de20b07f4953fc163a1acdb5a5eef417613e Mon Sep 17 00:00:00 2001
From: AJ Acevedo
Date: Fri, 7 Jun 2013 02:38:23 -0400
Subject: Update Getting Started Guide - Strong Parameters modified:
guides/source/getting_started.md
---
guides/source/getting_started.md | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
(limited to 'guides/source')
diff --git a/guides/source/getting_started.md b/guides/source/getting_started.md
index 1b30f4b728..69ee93925a 100644
--- a/guides/source/getting_started.md
+++ b/guides/source/getting_started.md
@@ -531,21 +531,28 @@ and change the `create` action to look like this:
```ruby
def create
- @post = Post.new(params[:post])
-
+ @post = Post.new(post_params)
+
@post.save
- redirect_to @post
+ redirect_to @post
end
+
+private
+ def post_params
+ params.require(:post).permit(:title, :text)
+ end
```
Here's what's going on: every Rails model can be initialized with its
respective attributes, which are automatically mapped to the respective
database columns. In the first line we do just that (remember that
-`params[:post]` contains the attributes we're interested in). Then,
+`post_params` contains the attributes we're interested in). Then,
`@post.save` is responsible for saving the model in the database.
Finally, we redirect the user to the `show` action,
which we'll define later.
+TIP: Note that `def post_params` is private. This new approach prevents an attacker from setting the model’s attributes by manipulating the hash passed to the model. For more information, refer to [this blog post about Strong Parameters](http://weblog.rubyonrails.org/2012/3/21/strong-parameters/).
+
TIP: As we'll see later, `@post.save` returns a boolean indicating
whether the model was saved or not.
--
cgit v1.2.3
From ad3d333321d2cfdac87600f6440bc69b0945f37c Mon Sep 17 00:00:00 2001
From: Steve Klabnik
Date: Sat, 8 Jun 2013 16:05:43 +0800
Subject: =?UTF-8?q?=E2=80=99=20->=20'=20[ci=20skip]?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
guides/source/getting_started.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'guides/source')
diff --git a/guides/source/getting_started.md b/guides/source/getting_started.md
index 69ee93925a..e26ebae0fb 100644
--- a/guides/source/getting_started.md
+++ b/guides/source/getting_started.md
@@ -551,7 +551,7 @@ database columns. In the first line we do just that (remember that
Finally, we redirect the user to the `show` action,
which we'll define later.
-TIP: Note that `def post_params` is private. This new approach prevents an attacker from setting the model’s attributes by manipulating the hash passed to the model. For more information, refer to [this blog post about Strong Parameters](http://weblog.rubyonrails.org/2012/3/21/strong-parameters/).
+TIP: Note that `def post_params` is private. This new approach prevents an attacker from setting the model's attributes by manipulating the hash passed to the model. For more information, refer to [this blog post about Strong Parameters](http://weblog.rubyonrails.org/2012/3/21/strong-parameters/).
TIP: As we'll see later, `@post.save` returns a boolean indicating
whether the model was saved or not.
--
cgit v1.2.3
From 1f4c4c69ee5d0cc37ed35ffd3d27fb29c72751cf Mon Sep 17 00:00:00 2001
From: Rashmi Yadav
Date: Sat, 8 Jun 2013 13:53:12 +0200
Subject: Middleware in guide updated [ci skip]
---
guides/source/rails_on_rack.md | 6 ++++++
1 file changed, 6 insertions(+)
(limited to 'guides/source')
diff --git a/guides/source/rails_on_rack.md b/guides/source/rails_on_rack.md
index 4b77892dd3..2f36e4b8ac 100644
--- a/guides/source/rails_on_rack.md
+++ b/guides/source/rails_on_rack.md
@@ -131,6 +131,7 @@ use ActionDispatch::DebugExceptions
use ActionDispatch::RemoteIp
use ActionDispatch::Reloader
use ActionDispatch::Callbacks
+use ActiveRecord::Migration::CheckPending
use ActiveRecord::ConnectionAdapters::ConnectionManagement
use ActiveRecord::QueryCache
use ActionDispatch::Cookies
@@ -272,6 +273,11 @@ Much of Action Controller's functionality is implemented as Middlewares. The fol
* Runs the prepare callbacks before serving the request.
+
+ **`ActiveRecord::Migration::CheckPending`**
+
+* Checks pending migrations and raise an error if migrations are pending.
+
**`ActiveRecord::ConnectionAdapters::ConnectionManagement`**
* Cleans active connections after each request, unless the `rack.test` key in the request environment is set to `true`.
--
cgit v1.2.3
From ad2dc5f90c688745e663bc8d2b7ca401515c27c9 Mon Sep 17 00:00:00 2001
From: Jeff Cohen
Date: Sat, 8 Jun 2013 11:10:30 -0500
Subject: Describe ActiveSupport core extensions for BigDecimal, JSON support,
and instance variable names.
---
guides/source/active_support_core_extensions.md | 66 ++++++++++++++++++++++++-
1 file changed, 65 insertions(+), 1 deletion(-)
(limited to 'guides/source')
diff --git a/guides/source/active_support_core_extensions.md b/guides/source/active_support_core_extensions.md
index 274cffbfab..0a29d85303 100644
--- a/guides/source/active_support_core_extensions.md
+++ b/guides/source/active_support_core_extensions.md
@@ -418,6 +418,14 @@ TIP: Since `with_options` forwards calls to its receiver they can be nested. Eac
NOTE: Defined in `active_support/core_ext/object/with_options.rb`.
+### JSON support
+
+Active Support provides a better implemention of `to_json` than the json gem ordinarily provides for Ruby objects. This is because some classes, like Hash and OrderedHash, needs special handling in order to provide a proper JSON representation.
+
+Active Support also provides an implementation of `as_json` for the Process::Status class.
+
+NOTE: Defined in `active_support/core_ext/object/to_json.rb`.
+
### Instance Variables
Active Support provides several methods to ease access to instance variables.
@@ -439,6 +447,39 @@ C.new(0, 1).instance_values # => {"x" => 0, "y" => 1}
NOTE: Defined in `active_support/core_ext/object/instance_variables.rb`.
+#### `instance_values`
+
+The method `instance_values` returns a hash that maps instance variable names without "@" to their
+corresponding values. Keys are strings:
+
+```ruby
+class C
+ def initialize(x, y)
+ @x, @y = x, y
+ end
+end
+
+C.new(0, 1).instance_values # => {"x" => 0, "y" => 1}
+```
+
+NOTE: Defined in `active_support/core_ext/object/instance_variables.rb`.
+
+#### `instance_variable_names`
+
+The method `instance_variable_names` returns an array. Each name includes the "@" sign.
+
+```ruby
+class C
+ def initialize(x, y)
+ @x, @y = x, y
+ end
+end
+
+C.new(0, 1).instance_variable_names # => ["@x", "@y"]
+```
+
+NOTE: Defined in `active_support/core_ext/object/instance_variables.rb`.
+
### Silencing Warnings, Streams, and Exceptions
The methods `silence_warnings` and `enable_warnings` change the value of `$VERBOSE` accordingly for the duration of their block, and reset it afterwards:
@@ -2011,8 +2052,31 @@ NOTE: Defined in `active_support/core_ext/integer/inflections.rb`.
Extensions to `BigDecimal`
--------------------------
+### `to_s`
+The method `to_s` is aliased to `to_formatted_s`. This provides a convenient way to display a BigDecimal value in floating-point notation:
-...
+```ruby
+BigDecimal.new(5.00, 6).to_s # => "5.0"
+```
+
+### `to_formatted_s`
+Te method `to_formatted_s` provides a default specifier of "F". This means that a simple call to `to_formatted_s` or `to_s` will result in floating point representation instead of engineering notation:
+
+```ruby
+BigDecimal.new(5.00, 6).to_formatted_s # => "5.0"
+```
+
+and that symbol specifiers are also supported:
+
+```ruby
+BigDecimal.new(5.00, 6).to_formatted_s(:db) # => "5.0"
+```
+
+Engineering notation is still supported:
+
+```ruby
+BigDecimal.new(5.00, 6).to_formatted_s("e") # => "0.5E1"
+```
Extensions to `Enumerable`
--------------------------
--
cgit v1.2.3
From 5c1a2cf6b309093ad5a6bb5d43364167ceaa7675 Mon Sep 17 00:00:00 2001
From: barelyknown
Date: Sat, 8 Jun 2013 12:36:53 -0400
Subject: change format example to read better when rendered with full_messages
The capital O was awkward and the validation wouldn't read "right" to the user.
---
guides/source/active_record_validations.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'guides/source')
diff --git a/guides/source/active_record_validations.md b/guides/source/active_record_validations.md
index 621d2222ff..f10f0254e5 100644
--- a/guides/source/active_record_validations.md
+++ b/guides/source/active_record_validations.md
@@ -357,7 +357,7 @@ given regular expression, which is specified using the `:with` option.
```ruby
class Product < ActiveRecord::Base
validates :legacy_code, format: { with: /\A[a-zA-Z]+\z/,
- message: "Only letters allowed" }
+ message: "only allows letters" }
end
```
--
cgit v1.2.3
From ad694f2f264b5afe04af77b3f43971984f32808c Mon Sep 17 00:00:00 2001
From: Rashmi Yadav
Date: Wed, 12 Jun 2013 23:04:40 +0200
Subject: Using 1.9 syntax for edge guides
---
guides/source/active_record_validations.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
(limited to 'guides/source')
diff --git a/guides/source/active_record_validations.md b/guides/source/active_record_validations.md
index e155a2f7b3..12be7c1dec 100644
--- a/guides/source/active_record_validations.md
+++ b/guides/source/active_record_validations.md
@@ -736,8 +736,8 @@ class Topic < ActiveRecord::Base
validates :title, length: { is: 5 }, allow_blank: true
end
-Topic.create("title" => "").valid? # => true
-Topic.create("title" => nil).valid? # => true
+Topic.create(title: "").valid? # => true
+Topic.create(title: nil).valid? # => true
```
### `:message`
--
cgit v1.2.3
From 1283a52db82b5a3f55577ff9ec0ed71d6243414d Mon Sep 17 00:00:00 2001
From: Vijay Dev
Date: Fri, 14 Jun 2013 00:30:40 +0530
Subject: Revert "Whitespace trimming in guides generation"
This reverts commit 91a1cf7013252753567b36f61bfcd5fd0a5bb2b8.
Reason: code changes disallowed in docrails, even if they are
guides generation related.
---
guides/source/credits.html.erb | 4 ++--
guides/source/kindle/toc.ncx.erb | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
(limited to 'guides/source')
diff --git a/guides/source/credits.html.erb b/guides/source/credits.html.erb
index 8f546784ec..10dd8178fb 100644
--- a/guides/source/credits.html.erb
+++ b/guides/source/credits.html.erb
@@ -32,8 +32,8 @@ Ruby on Rails Guides: Credits
<% end %>
<%= author('Oscar Del Ben', 'oscardelben', 'oscardelben.jpg') do %>
- Oscar Del Ben is a software engineer at Wildfire. He's a regular open source contributor (GitHub account) and tweets regularly at @oscardelben.
-<% end %>
+Oscar Del Ben is a software engineer at Wildfire. He's a regular open source contributor (GitHub account) and tweets regularly at @oscardelben.
+ <% end %>
<%= author('Frederick Cheung', 'fcheung') do %>
Frederick Cheung is Chief Wizard at Texperts where he has been using Rails since 2006. He is based in Cambridge (UK) and when not consuming fine ales he blogs at spacevatican.org.
diff --git a/guides/source/kindle/toc.ncx.erb b/guides/source/kindle/toc.ncx.erb
index 24ca6c88c9..2c6d8e3bdf 100644
--- a/guides/source/kindle/toc.ncx.erb
+++ b/guides/source/kindle/toc.ncx.erb
@@ -37,7 +37,7 @@
Copyright & License
-
+
<% play_order = 4 %>
@@ -47,7 +47,7 @@
<%= section['name'] %>
-
+
<% section['documents'].each_with_index do |document, document_no| %>
--
cgit v1.2.3
From c78b4310cf2e2264461e639371de171e47cfc9d5 Mon Sep 17 00:00:00 2001
From: Vijay Dev
Date: Fri, 14 Jun 2013 00:55:05 +0530
Subject: Revert "Add detailed steps on how to squash multiple commits into a
single detailed commit"
This reverts commit 6df9c595ad8e473d15a81a9291e891476bc833c2.
---
guides/source/contributing_to_ruby_on_rails.md | 25 -------------------------
1 file changed, 25 deletions(-)
(limited to 'guides/source')
diff --git a/guides/source/contributing_to_ruby_on_rails.md b/guides/source/contributing_to_ruby_on_rails.md
index 035db93a1a..0be9bb1ced 100644
--- a/guides/source/contributing_to_ruby_on_rails.md
+++ b/guides/source/contributing_to_ruby_on_rails.md
@@ -325,31 +325,6 @@ You can also add bullet points:
TIP. Please squash your commits into a single commit when appropriate. This simplifies future cherry picks, and also keeps the git log clean.
-For example, to squash the previous three commits into one commit with a detailed commit message:
-
-```bash
-$ git rebase -i HEAD~3
-```
-
-Your editor will now open with the previous 3 commits listed:
-
-```
-pick 7ac1d4 description of first commit message
-pick 2b5aa3 description of second commit message
-pick da472c description of third commit message
-```
-
-Now squash the commits into the first commit
-
-```
-pick 7ac1d4 description of first commit message
-squash 2b5aa3 description of second commit message
-squash da472c description of third commit message
-```
-
-Ater saving and closing the editor, a new editor will open giving you the opportunity to write a detailed commit message for the newly squashed commit.
-
-
### Update Your Branch
It’s pretty likely that other changes to master have happened while you were working. Go get them:
--
cgit v1.2.3
From 7663149f72b5dba15a8e850e4072a016341e541c Mon Sep 17 00:00:00 2001
From: Vijay Dev
Date: Fri, 14 Jun 2013 00:58:11 +0530
Subject: copy edits [ci skip]
---
guides/source/migrations.md | 20 +++++++++-----------
guides/source/rails_on_rack.md | 3 +--
guides/source/testing.md | 4 ++--
3 files changed, 12 insertions(+), 15 deletions(-)
(limited to 'guides/source')
diff --git a/guides/source/migrations.md b/guides/source/migrations.md
index 194ae276ec..eb0cfd9451 100644
--- a/guides/source/migrations.md
+++ b/guides/source/migrations.md
@@ -366,26 +366,24 @@ create_join_table :products, :categories
which creates a `categories_products` table with two columns called
`category_id` and `product_id`. These columns have the option `:null` set to
-`false` by default.
-
-You can pass the option `:table_name` with you want to customize the table
-name. For example,
+`false` by default. This can be overridden by specifying the `:column_options`
+option.
```ruby
-create_join_table :products, :categories, table_name: :categorization
+create_join_table :products, :categories, column_options: {null: true}
```
-will create a `categorization` table.
+will create the `product_id` and `category_id` with the `:null` option as
+`true`.
-For the two table columns, you can override the default `:null` option, or add
-others, by specifying the `:column_options` option. For example,
+You can pass the option `:table_name` with you want to customize the table
+name. For example,
```ruby
-create_join_table :products, :categories, column_options: {null: true}
+create_join_table :products, :categories, table_name: :categorization
```
-will create the `product_id` and `category_id` with the `:null` option as
-`true`.
+will create a `categorization` table.
`create_join_table` also accepts a block, which you can use to add indices
(which are not created by default) or additional columns:
diff --git a/guides/source/rails_on_rack.md b/guides/source/rails_on_rack.md
index 2f36e4b8ac..d144fba762 100644
--- a/guides/source/rails_on_rack.md
+++ b/guides/source/rails_on_rack.md
@@ -273,10 +273,9 @@ Much of Action Controller's functionality is implemented as Middlewares. The fol
* Runs the prepare callbacks before serving the request.
-
**`ActiveRecord::Migration::CheckPending`**
-* Checks pending migrations and raise an error if migrations are pending.
+* Checks pending migrations and raises `ActiveRecord::PendingMigrationError` if any migrations are pending.
**`ActiveRecord::ConnectionAdapters::ConnectionManagement`**
diff --git a/guides/source/testing.md b/guides/source/testing.md
index 95d454ba9d..416a8b592f 100644
--- a/guides/source/testing.md
+++ b/guides/source/testing.md
@@ -767,8 +767,8 @@ Rake Tasks for Running your Tests
You don't need to set up and run your tests by hand on a test-by-test basis. Rails comes with a number of commands to help in testing. The table below lists all commands that come along in the default Rakefile when you initiate a Rails project.
-| Tasks | Description |
-| ------------------------ | ----------- |
+| Tasks | Description |
+| ----------------------- | ----------- |
| `rake test` | Runs all unit, functional and integration tests. You can also simply run `rake test` as Rails will run all the tests by default|
| `rake test:controllers` | Runs all the controller tests from `test/controllers`|
| `rake test:functionals` | Runs all the functional tests from `test/controllers`, `test/mailers`, and `test/functional`|
--
cgit v1.2.3
From 2f0a5c7ac506b900d101620c4cc338a88ee620e3 Mon Sep 17 00:00:00 2001
From: Vijay Dev
Date: Fri, 14 Jun 2013 01:07:02 +0530
Subject: copy editing AS guide [ci skip]
---
guides/source/active_support_core_extensions.md | 23 ++++-------------------
1 file changed, 4 insertions(+), 19 deletions(-)
(limited to 'guides/source')
diff --git a/guides/source/active_support_core_extensions.md b/guides/source/active_support_core_extensions.md
index 0a29d85303..7f65d920df 100644
--- a/guides/source/active_support_core_extensions.md
+++ b/guides/source/active_support_core_extensions.md
@@ -420,9 +420,9 @@ NOTE: Defined in `active_support/core_ext/object/with_options.rb`.
### JSON support
-Active Support provides a better implemention of `to_json` than the json gem ordinarily provides for Ruby objects. This is because some classes, like Hash and OrderedHash, needs special handling in order to provide a proper JSON representation.
+Active Support provides a better implemention of `to_json` than the +json+ gem ordinarily provides for Ruby objects. This is because some classes, like +Hash+ and +OrderedHash+ needs special handling in order to provide a proper JSON representation.
-Active Support also provides an implementation of `as_json` for the Process::Status class.
+Active Support also provides an implementation of `as_json` for the Process::Status class.
NOTE: Defined in `active_support/core_ext/object/to_json.rb`.
@@ -447,23 +447,6 @@ C.new(0, 1).instance_values # => {"x" => 0, "y" => 1}
NOTE: Defined in `active_support/core_ext/object/instance_variables.rb`.
-#### `instance_values`
-
-The method `instance_values` returns a hash that maps instance variable names without "@" to their
-corresponding values. Keys are strings:
-
-```ruby
-class C
- def initialize(x, y)
- @x, @y = x, y
- end
-end
-
-C.new(0, 1).instance_values # => {"x" => 0, "y" => 1}
-```
-
-NOTE: Defined in `active_support/core_ext/object/instance_variables.rb`.
-
#### `instance_variable_names`
The method `instance_variable_names` returns an array. Each name includes the "@" sign.
@@ -2053,6 +2036,7 @@ NOTE: Defined in `active_support/core_ext/integer/inflections.rb`.
Extensions to `BigDecimal`
--------------------------
### `to_s`
+
The method `to_s` is aliased to `to_formatted_s`. This provides a convenient way to display a BigDecimal value in floating-point notation:
```ruby
@@ -2060,6 +2044,7 @@ BigDecimal.new(5.00, 6).to_s # => "5.0"
```
### `to_formatted_s`
+
Te method `to_formatted_s` provides a default specifier of "F". This means that a simple call to `to_formatted_s` or `to_s` will result in floating point representation instead of engineering notation:
```ruby
--
cgit v1.2.3
From 2d5a6de4e227ee97ccbea691c69728b7e31bf678 Mon Sep 17 00:00:00 2001
From: Terence Lee
Date: Tue, 4 Jun 2013 17:52:54 +0900
Subject: `initialize_on_precompile` is not used anymore.
---
guides/source/asset_pipeline.md | 19 -------------------
1 file changed, 19 deletions(-)
(limited to 'guides/source')
diff --git a/guides/source/asset_pipeline.md b/guides/source/asset_pipeline.md
index 3b3707d9e5..b68c24acfd 100644
--- a/guides/source/asset_pipeline.md
+++ b/guides/source/asset_pipeline.md
@@ -419,17 +419,6 @@ The rake task is:
$ RAILS_ENV=production bundle exec rake assets:precompile
```
-For faster asset precompiles, you can partially load your application by setting
-`config.assets.initialize_on_precompile` to false in `config/application.rb`, though in that case templates
-cannot see application objects or methods. **Heroku requires this to be false.**
-
-WARNING: If you set `config.assets.initialize_on_precompile` to false, be sure to
-test `rake assets:precompile` locally before deploying. It may expose bugs where
-your assets reference application objects or methods, since those are still
-in scope in development mode regardless of the value of this flag. Changing this flag also affects
-engines. Engines can define assets for precompilation as well. Since the complete environment is not loaded,
-engines (or other gems) will not be loaded, which can cause missing assets.
-
Capistrano (v2.15.1 and above) includes a recipe to handle this in deployment. Add the following line to `Capfile`:
```ruby
@@ -570,16 +559,8 @@ In `config/environments/development.rb`, place the following line:
config.assets.prefix = "/dev-assets"
```
-You will also need this in application.rb:
-
-```ruby
-config.assets.initialize_on_precompile = false
-```
-
The `prefix` change makes Rails use a different URL for serving assets in development mode, and pass all requests to Sprockets. The prefix is still set to `/assets` in the production environment. Without this change, the application would serve the precompiled assets from `public/assets` in development, and you would not see any local changes until you compile assets again.
-The `initialize_on_precompile` change tells the precompile task to run without invoking Rails. This is because the precompile task runs in production mode by default, and will attempt to connect to your specified production database. Please note that you cannot have code in pipeline files that relies on Rails resources (such as the database) when compiling locally with this option.
-
You will also need to ensure that any compressors or minifiers are available on your development system.
In practice, this will allow you to precompile locally, have those files in your working tree, and commit those files to source control when needed. Development mode will work as expected.
--
cgit v1.2.3
From cbde6f56aed9119585de734de56056211aad36f5 Mon Sep 17 00:00:00 2001
From: Prathamesh Sonpatki
Date: Thu, 13 Jun 2013 23:30:14 +0530
Subject: Added an example of the query without except before the example with
except
---
guides/source/active_record_querying.md | 8 ++++++++
1 file changed, 8 insertions(+)
(limited to 'guides/source')
diff --git a/guides/source/active_record_querying.md b/guides/source/active_record_querying.md
index 84fc254207..2555927d15 100644
--- a/guides/source/active_record_querying.md
+++ b/guides/source/active_record_querying.md
@@ -687,6 +687,10 @@ The SQL that would be executed:
```sql
SELECT * FROM posts WHERE id > 10 LIMIT 20
+
+# Original query without `except`
+SELECT * FROM posts WHERE id > 10 ORDER BY id asc LIMIT 20
+
```
### `unscope`
@@ -722,6 +726,10 @@ The SQL that would be executed:
```sql
SELECT * FROM posts WHERE id > 10 ORDER BY id DESC
+
+# Original query without `only`
+SELECT "posts".* FROM "posts" WHERE (id > 10) ORDER BY id desc LIMIT 20
+
```
### `reorder`
--
cgit v1.2.3
From f0e4254bfa1443c3d51af117b925a02b88076f58 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C4=B1tk=C4=B1=20Ba=C4=9Fdat?=
Date: Mon, 17 Jun 2013 03:22:31 +0300
Subject: Use Colspan in th Tags
Is it more suitable that using `````` instead of three empty ``` | ```? It is simple, but what i am missing about it?
Change repetitive th tags to use colspan attribute
Update CHANGELOG.md
Update CHANGELOG.md
---
guides/source/getting_started.md | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
(limited to 'guides/source')
diff --git a/guides/source/getting_started.md b/guides/source/getting_started.md
index 2fb0cd7c72..0d44f0e776 100644
--- a/guides/source/getting_started.md
+++ b/guides/source/getting_started.md
@@ -932,8 +932,7 @@ appear next to the "Show" link:
|
Title |
Text |
- |
- |
+ |
<% @posts.each do |post| %>
@@ -1073,9 +1072,7 @@ together.
Title |
Text |
- |
- |
- |
+ |
<% @posts.each do |post| %>
--
cgit v1.2.3