diff options
author | Jaime Iniesta <jaimeiniesta@gmail.com> | 2012-10-15 16:58:47 +0200 |
---|---|---|
committer | Jaime Iniesta <jaimeiniesta@gmail.com> | 2012-10-15 16:58:47 +0200 |
commit | b8dafa31ec202d63e624b67f2f6c648bdb89ca0b (patch) | |
tree | 6c839689487497c379bbce65ec6d481c4e3dbf18 /guides/source | |
parent | fe5f5d11c1b27e34d281ea301c47d2ce71592a69 (diff) | |
download | rails-b8dafa31ec202d63e624b67f2f6c648bdb89ca0b.tar.gz rails-b8dafa31ec202d63e624b67f2f6c648bdb89ca0b.tar.bz2 rails-b8dafa31ec202d63e624b67f2f6c648bdb89ca0b.zip |
Fix formatting errors on the Active Record Validations and Callbacks guide
Diffstat (limited to 'guides/source')
-rw-r--r-- | guides/source/active_record_validations_callbacks.md | 13 |
1 files changed, 8 insertions, 5 deletions
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> + +```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 -</ruby> +``` 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_<em>attribute</em>` -* `find_by_<em>attribute</em>` -* `find_by_<em>attribute</em>!` +* `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 ------------------ |