From b8dafa31ec202d63e624b67f2f6c648bdb89ca0b Mon Sep 17 00:00:00 2001 From: Jaime Iniesta Date: Mon, 15 Oct 2012 16:58:47 +0200 Subject: Fix formatting errors on the Active Record Validations and Callbacks guide --- guides/source/active_record_validations_callbacks.md | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'guides/source/active_record_validations_callbacks.md') diff --git a/guides/source/active_record_validations_callbacks.md b/guides/source/active_record_validations_callbacks.md index b350b892bc..7555ef4226 100644 --- a/guides/source/active_record_validations_callbacks.md +++ b/guides/source/active_record_validations_callbacks.md @@ -999,7 +999,8 @@ end ``` Callbacks can also be registered to only fire on certain lifecycle events: - + +```ruby class User < ActiveRecord::Base before_validation :normalize_name, on: :create @@ -1015,7 +1016,7 @@ class User < ActiveRecord::Base self.location = LocationService.query(self) end end - +``` It is considered good practice to declare callback methods as protected or private. If left public, they can be called from outside of the model and violate the principle of object encapsulation. @@ -1109,14 +1110,16 @@ Additionally, the `after_find` callback is triggered by the following finder met * `all` * `first` * `find` -* `find_all_by_attribute` -* `find_by_attribute` -* `find_by_attribute!` +* `find_all_by_*` +* `find_by_*` +* `find_by_*!` * `find_by_sql` * `last` The `after_initialize` callback is triggered every time a new object of the class is initialized. +NOTE: The `find_all_by_*`, `find_by_*` and `find_by_*!` methods are dynamic finders generated automatically for every attribute. Learn more about them at the [Dynamic finders section](active_record_querying.html#dynamic-finders) + Skipping Callbacks ------------------ -- cgit v1.2.3