Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix validation based on object not _id.

From #6161
  • Loading branch information...
commit cfd324b4b68469ba3188e4b7ba8586e59b239693 1 parent ba2fed4
@steveklabnik steveklabnik authored
Showing with 2 additions and 2 deletions.
  1. +2 −2 guides/source/active_record_validations_callbacks.md
View
4 guides/source/active_record_validations_callbacks.md
@@ -372,12 +372,12 @@ class Person < ActiveRecord::Base
end
```
-If you want to be sure that an association is present, you'll need to test whether the foreign key used to map the association is present, and not the associated object itself.
+If you want to be sure that an association is present, you'll need to test the associated object itself, and not whether the foreign key used to map the association is present:
```ruby
class LineItem < ActiveRecord::Base
belongs_to :order
- validates :order_id, presence: true
+ validates :order, presence: true
end
```
Please sign in to comment.
Something went wrong with that request. Please try again.