Skip to content

Commit

Permalink
Merge branch 'master' of github.com:rails/docrails
Browse files Browse the repository at this point in the history
  • Loading branch information
vijaydev committed Apr 18, 2014
2 parents 2ff138b + e507193 commit c2fa85f
Show file tree
Hide file tree
Showing 10 changed files with 161 additions and 123 deletions.
4 changes: 2 additions & 2 deletions actionpack/RUNNING_UNIT_TESTS.rdoc
Expand Up @@ -8,10 +8,10 @@ Rake can be found at http://rake.rubyforge.org.

== Running by hand

To run a single test suite
Run a single test suite:

rake test TEST=path/to/test.rb

which can be further narrowed down to one test:
Run one test in a test suite:

rake test TEST=path/to/test.rb TESTOPTS="--name=test_something"
Expand Up @@ -62,8 +62,8 @@ def uri_parser

# Converts the query parameters of the URI into a hash.
#
# "localhost?pool=5&reap_frequency=2"
# # => { "pool" => "5", "reap_frequency" => "2" }
# "localhost?pool=5&reaping_frequency=2"
# # => { "pool" => "5", "reaping_frequency" => "2" }
#
# returns empty hash if no query present.
#
Expand Down
5 changes: 4 additions & 1 deletion activesupport/lib/active_support/core_ext/load_error.rb
Expand Up @@ -7,6 +7,7 @@ class LoadError
]

unless method_defined?(:path)
# Returns the path which was unable to be loaded.
def path
@path ||= begin
REGEXPS.find do |regex|
Expand All @@ -17,9 +18,11 @@ def path
end
end

# Returns true if the given path name (except perhaps for the ".rb"
# extension) is the missing file which caused the exception to be raised.
def is_missing?(location)
location.sub(/\.rb$/, '') == path.sub(/\.rb$/, '')
end
end

MissingSourceFile = LoadError
MissingSourceFile = LoadError
7 changes: 7 additions & 0 deletions activesupport/lib/active_support/core_ext/thread.rb
Expand Up @@ -62,6 +62,13 @@ def thread_variable?(key)
_locals.has_key?(key.to_sym)
end

# Freezes the thread so that thread local variables cannot be set via
# Thread#thread_variable_set, nor can fiber local variables be set.
#
# me = Thread.current
# me.freeze
# me.thread_variable_set(:oliver, "a") #=> RuntimeError: can't modify frozen thread locals
# me[:oliver] = "a" #=> RuntimeError: can't modify frozen thread locals
def freeze
_locals.freeze
super
Expand Down
6 changes: 3 additions & 3 deletions guides/source/active_support_core_extensions.md
Expand Up @@ -2910,7 +2910,7 @@ NOTE: Defined in `active_support/core_ext/hash/indifferent_access.rb`.

### Compacting

The methods `compact` and `compact!` return a Hash without items with `nil` value.
The methods `compact` and `compact!` return a Hash without items with `nil` value.

```ruby
{a: 1, b: 2, c: nil}.compact # => {a: 1, b: 2}
Expand Down Expand Up @@ -3837,7 +3837,7 @@ rescue NameError => e
end
```

NOTE: Defined in `actionpack/lib/abstract_controller/helpers.rb`.
NOTE: Defined in `active_support/core_ext/name_error.rb`.

Extensions to `LoadError`
-------------------------
Expand All @@ -3860,4 +3860,4 @@ rescue NameError => e
end
```

NOTE: Defined in `actionpack/lib/abstract_controller/helpers.rb`.
NOTE: Defined in `active_support/core_ext/load_error.rb`.
4 changes: 2 additions & 2 deletions guides/source/asset_pipeline.md
Expand Up @@ -56,7 +56,7 @@ the comment operator on that line to later enable the asset pipeline:

To set asset compression methods, set the appropriate configuration options
in `production.rb` - `config.assets.css_compressor` for your CSS and
`config.assets.js_compressor` for your Javascript:
`config.assets.js_compressor` for your JavaScript:

```ruby
config.assets.css_compressor = :yui
Expand Down Expand Up @@ -766,7 +766,7 @@ exception indicating the name of the missing file(s).

#### Far-future Expires Header

Precompiled assets exist on the filesystem and are served directly by your web
Precompiled assets exist on the file system and are served directly by your web
server. They do not have far-future headers by default, so to get the benefit of
fingerprinting you'll have to update your server configuration to add those
headers.
Expand Down
2 changes: 1 addition & 1 deletion guides/source/command_line.md
Expand Up @@ -254,7 +254,7 @@ $ rails generate scaffold HighScore game:string score:integer
The generator checks that there exist the directories for models, controllers, helpers, layouts, functional and unit tests, stylesheets, creates the views, controller, model and database migration for HighScore (creating the `high_scores` table and fields), takes care of the route for the **resource**, and new tests for everything.
The migration requires that we **migrate**, that is, run some Ruby code (living in that `20130717151933_create_high_scores.rb`) to modify the schema of our database. Which database? The sqlite3 database that Rails will create for you when we run the `rake db:migrate` command. We'll talk more about Rake in-depth in a little while.
The migration requires that we **migrate**, that is, run some Ruby code (living in that `20130717151933_create_high_scores.rb`) to modify the schema of our database. Which database? The SQLite3 database that Rails will create for you when we run the `rake db:migrate` command. We'll talk more about Rake in-depth in a little while.
```bash
$ rake db:migrate
Expand Down
14 changes: 11 additions & 3 deletions guides/source/configuring.md
Expand Up @@ -644,18 +644,26 @@ development:
encoding: unicode
database: blog_development
pool: 5
username: blog
password:
```

Prepared Statements can be disabled thus:
Prepared Statements are enabled by default on PostgreSQL. You can be disable prepared statements by setting `prepared_statements` to `false`:

```yaml
production:
adapter: postgresql
prepared_statements: false
```

If enabled, Active Record will create up to `1000` prepared statements per database connection by default. To modify this behavior you can set `statement_limit` to a different value:

```
production:
adapter: postgresql
statement_limit: 200
```

The more prepared statements in use: the more memory your database will require. If your PostgreSQL database is hitting memory limits, try lowering `statement_limit` or disabling prepared statements.

#### Configuring an SQLite3 Database for JRuby Platform

If you choose to use SQLite3 and are using JRuby, your `config/database.yml` will look a little different. Here's the development section:
Expand Down

0 comments on commit c2fa85f

Please sign in to comment.