Skip to content

Commit f597122

Browse files
committed
Merge branch 'master' of github.com:lifo/docrails
2 parents 699ba8a + 547e695 commit f597122

File tree

4 files changed

+20
-2
lines changed

4 files changed

+20
-2
lines changed

railties/guides/source/active_record_validations_callbacks.textile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,18 @@ class Person < ActiveRecord::Base
517517
end
518518
</ruby>
519519

520+
h3. Strict Validations
521+
522+
You can also specify validations to be strict and raise +ActiveModel::StrictValidationFailed+ when the object is invalid.
523+
524+
<ruby>
525+
class Person < ActiveRecord::Base
526+
validates :name, :presence => { :strict => true }
527+
end
528+
529+
Person.new.valid? => ActiveModel::StrictValidationFailed: Name can't be blank
530+
</ruby>
531+
520532
h3. Conditional Validation
521533

522534
Sometimes it will make sense to validate an object just when a given predicate is satisfied. You can do that by using the +:if+ and +:unless+ options, which can take a symbol, a string or a +Proc+. You may use the +:if+ option when you want to specify when the validation *should* happen. If you want to specify when the validation *should not* happen, then you may use the +:unless+ option.

railties/guides/source/caching_with_rails.textile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ h4. ActiveSupport::Cache::NullStore
359359
This cache store implementation is meant to be used only in development or test environments and it never stores anything. This can be very useful in development when you have code that interacts directly with +Rails.cache+, but caching may interfere with being able to see the results of code changes. With this cache store, all +fetch+ and +read+ operations will result in a miss.
360360

361361
<ruby>
362-
ActionController::Base.cache_store = :null
362+
ActionController::Base.cache_store = :null_store
363363
</ruby>
364364

365365
h4. Custom Cache Stores

railties/guides/source/layouts_and_rendering.textile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ class ProductsController < ApplicationController
359359
end
360360
</ruby>
361361

362-
With this declaration, all of the methods within +ProductsController+ will use +app/views/layouts/inventory.html.erb+ for their layout.
362+
With this declaration, all of the views rendered by the products controller will use +app/views/layouts/inventory.html.erb+ as their layout.
363363

364364
To assign a specific layout for the entire application, use a +layout+ declaration in your +ApplicationController+ class:
365365

railties/guides/source/routing.textile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,12 @@ If you wanted to link to just a magazine, you could leave out the +Array+:
301301
<%= link_to "Magazine details", @magazine %>
302302
</erb>
303303

304+
For other actions, you just need to insert the action name as the first element of the +Array+:
305+
306+
<erb>
307+
<%= link_to "Edit Ad", [:edit, @magazine, @ad] %>
308+
</erb>
309+
304310
This allows you to treat instances of your models as URLs, and is a key advantage to using the resourceful style.
305311

306312
h4. Adding More RESTful Actions

0 commit comments

Comments
 (0)