aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--actionpack/lib/action_controller/metal/request_forgery_protection.rb1
-rw-r--r--actionpack/lib/action_dispatch/testing/assertions/response.rb2
-rw-r--r--actionpack/lib/action_view/helpers/form_tag_helper.rb2
-rw-r--r--guides/assets/stylesheets/main.css6
-rw-r--r--guides/code/getting_started/config/environments/production.rb2
-rw-r--r--guides/source/asset_pipeline.textile2
-rw-r--r--guides/source/engines.textile6
-rw-r--r--guides/source/layouts_and_rendering.textile14
-rw-r--r--guides/source/routing.textile11
-rw-r--r--guides/source/testing.textile2
10 files changed, 29 insertions, 19 deletions
diff --git a/actionpack/lib/action_controller/metal/request_forgery_protection.rb b/actionpack/lib/action_controller/metal/request_forgery_protection.rb
index 3081c14c09..0bff1825d9 100644
--- a/actionpack/lib/action_controller/metal/request_forgery_protection.rb
+++ b/actionpack/lib/action_controller/metal/request_forgery_protection.rb
@@ -17,7 +17,6 @@ module ActionController #:nodoc:
# CSRF protection is turned on with the <tt>protect_from_forgery</tt> method,
# which checks the token and resets the session if it doesn't match what was expected.
# A call to this method is generated for new \Rails applications by default.
- # You can customize the error message by editing public/422.html.
#
# The token parameter is named <tt>authenticity_token</tt> by default. The name and
# value of this token must be added to every layout that renders forms by including
diff --git a/actionpack/lib/action_dispatch/testing/assertions/response.rb b/actionpack/lib/action_dispatch/testing/assertions/response.rb
index a5e7a8c715..bea54f9778 100644
--- a/actionpack/lib/action_dispatch/testing/assertions/response.rb
+++ b/actionpack/lib/action_dispatch/testing/assertions/response.rb
@@ -8,7 +8,7 @@ module ActionDispatch
# Asserts that the response is one of the following types:
#
- # * <tt>:success</tt> - Status code was 200
+ # * <tt>:success</tt> - Status code was in the 200-299 range
# * <tt>:redirect</tt> - Status code was in the 300-399 range
# * <tt>:missing</tt> - Status code was 404
# * <tt>:error</tt> - Status code was in the 500-599 range
diff --git a/actionpack/lib/action_view/helpers/form_tag_helper.rb b/actionpack/lib/action_view/helpers/form_tag_helper.rb
index fb6dfff9b8..e403d6cf5e 100644
--- a/actionpack/lib/action_view/helpers/form_tag_helper.rb
+++ b/actionpack/lib/action_view/helpers/form_tag_helper.rb
@@ -101,7 +101,7 @@ module ActionView
# # => <select id="colors" multiple="multiple" name="colors[]"><option>Red</option>
# # <option>Green</option><option>Blue</option></select>
#
- # select_tag "locations", "<option>Home</option><option selected="selected">Work</option><option>Out</option>".html_safe
+ # select_tag "locations", "<option>Home</option><option selected='selected'>Work</option><option>Out</option>".html_safe
# # => <select id="locations" name="locations"><option>Home</option><option selected='selected'>Work</option>
# # <option>Out</option></select>
#
diff --git a/guides/assets/stylesheets/main.css b/guides/assets/stylesheets/main.css
index 90723cc8e1..42b85fefa3 100644
--- a/guides/assets/stylesheets/main.css
+++ b/guides/assets/stylesheets/main.css
@@ -80,7 +80,7 @@ body {
font-family: Helvetica, Arial, sans-serif;
font-size: 87.5%;
line-height: 1.5em;
- background: #222;
+ background: #fff;
min-width: 69em;
color: #999;
}
@@ -94,6 +94,7 @@ body {
#topNav {
padding: 1em 0;
color: #565656;
+ background: #222;
}
#header {
@@ -111,7 +112,6 @@ body {
}
#container {
- background: #FFF;
color: #333;
padding: 0.5em 0 1.5em 0;
}
@@ -137,7 +137,7 @@ body {
#footer {
padding: 2em 0;
- background: url(../images/footer_tile.gif) repeat-x;
+ background: #222 url(../images/footer_tile.gif) repeat-x;
}
#footer .wrapper {
padding-left: 2em;
diff --git a/guides/code/getting_started/config/environments/production.rb b/guides/code/getting_started/config/environments/production.rb
index cfb8c960d6..ecc35b030b 100644
--- a/guides/code/getting_started/config/environments/production.rb
+++ b/guides/code/getting_started/config/environments/production.rb
@@ -20,7 +20,7 @@ Blog::Application.configure do
# Generate digests for assets URLs.
config.assets.digest = true
- # Defaults to Rails.root.join("public/assets").
+ # Defaults to nil
# config.assets.manifest = YOUR_PATH
# Specifies the header that your server uses for sending files.
diff --git a/guides/source/asset_pipeline.textile b/guides/source/asset_pipeline.textile
index a1b7a42d66..464788f30f 100644
--- a/guides/source/asset_pipeline.textile
+++ b/guides/source/asset_pipeline.textile
@@ -673,7 +673,7 @@ config.assets.compile = false
# Generate digests for assets URLs.
config.assets.digest = true
-# Defaults to Rails.root.join("public/assets")
+# Defaults to nil and saved in location specified by config.assets.prefix
# config.assets.manifest = YOUR_PATH
# Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
diff --git a/guides/source/engines.textile b/guides/source/engines.textile
index 047f9afd76..20df254950 100644
--- a/guides/source/engines.textile
+++ b/guides/source/engines.textile
@@ -77,7 +77,7 @@ end
By inheriting from the +Rails::Engine+ class, this gem notifies Rails that there's an engine at the specified path, and will correctly mount the engine inside the application, performing tasks such as adding the +app+ directory of the engine to the load path for models, mailers, controllers and views.
-The +isolate_namespace+ method here deserves special notice. This call is responsible for isolating the controllers, models, routes and other things into their own namespace, away from similar components inside hte application. Without this, there is a possibility that the engine's components could "leak" into the application, causing unwanted disruption, or that important engine components could be overriden by similarly named things within the application. One of the examples of such conflicts are helpers. Without calling +isolate_namespace+, engine's helpers would be included in application's controllers.
+The +isolate_namespace+ method here deserves special notice. This call is responsible for isolating the controllers, models, routes and other things into their own namespace, away from similar components inside the application. Without this, there is a possibility that the engine's components could "leak" into the application, causing unwanted disruption, or that important engine components could be overridden by similarly named things within the application. One of the examples of such conflicts are helpers. Without calling +isolate_namespace+, engine's helpers would be included in application's controllers.
NOTE: It is *highly* recommended that the +isolate_namespace+ line be left within the +Engine+ class definition. Without it, classes generated in an engine *may* conflict with an application.
@@ -665,7 +665,7 @@ Try this now by creating a new file at +app/views/blorgh/posts/index.html.erb+ a
Rather than looking like the default scaffold, the page will now look like this:
-!images/engines_post_override.png(Engine scaffold overriden)!
+!images/engines_post_override.png(Engine scaffold overridden)!
h4. Routes
@@ -736,7 +736,7 @@ You can define assets for precompilation in +engine.rb+
initializer do |app|
app.config.assets.precompile += %w(admin.css admin.js)
end
-</ruby
+</ruby>
For more information, read the "Asset Pipeline guide":http://guides.rubyonrails.org/asset_pipeline.html
diff --git a/guides/source/layouts_and_rendering.textile b/guides/source/layouts_and_rendering.textile
index 4b4f9f3745..7c7fc7044c 100644
--- a/guides/source/layouts_and_rendering.textile
+++ b/guides/source/layouts_and_rendering.textile
@@ -1134,13 +1134,6 @@ In Rails 3.0, there is also a shorthand for this. Assuming +@products+ is a coll
Rails determines the name of the partial to use by looking at the model name in the collection. In fact, you can even create a heterogeneous collection and render it this way, and Rails will choose the proper partial for each member of the collection:
-In the event that the collection is empty, +render+ will return nil, so it should be fairly simple to provide alternative content.
-
-<erb>
-<h1>Products</h1>
-<%= render(@products) || 'There are no products available.' %>
-</erb>
-
* +index.html.erb+
<erb>
@@ -1162,6 +1155,13 @@ In the event that the collection is empty, +render+ will return nil, so it shoul
In this case, Rails will use the customer or employee partials as appropriate for each member of the collection.
+In the event that the collection is empty, +render+ will return nil, so it should be fairly simple to provide alternative content.
+
+<erb>
+<h1>Products</h1>
+<%= render(@products) || 'There are no products available.' %>
+</erb>
+
h5. Local Variables
To use a custom local variable name within the partial, specify the +:as+ option in the call to the partial:
diff --git a/guides/source/routing.textile b/guides/source/routing.textile
index e93b1280e0..75f4e82918 100644
--- a/guides/source/routing.textile
+++ b/guides/source/routing.textile
@@ -535,6 +535,17 @@ TwitterClone::Application.routes.draw do
end
</ruby>
+You can also specify constraints as a lambda:
+
+<ruby>
+TwitterClone::Application.routes.draw do
+ match "*path" => "blacklist#index",
+ :constraints => lambda { |request| Blacklist.retrieve_ips.include?(request.remote_ip) }
+end
+</ruby>
+
+Both the +matches?+ method and the lambda gets the +request+ object as an argument.
+
h4. Route Globbing
Route globbing is a way to specify that a particular parameter should be matched to all the remaining parts of a route. For example
diff --git a/guides/source/testing.textile b/guides/source/testing.textile
index 60b0aa89b9..d35be6a70e 100644
--- a/guides/source/testing.textile
+++ b/guides/source/testing.textile
@@ -412,7 +412,7 @@ NOTE: +assert_valid(record)+ has been deprecated. Please use +assert(record.vali
|+assert_no_difference(expressions, message = nil, &amp;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, +: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.|