diff options
author | Xavier Noria <fxn@hashref.com> | 2013-09-07 01:33:19 -0700 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2013-09-07 01:33:19 -0700 |
commit | c989a18a74d970be86c537766f14916bd06fe176 (patch) | |
tree | cf2ab71e426364c6b82e884b00146acf1345abc1 /guides/source/active_record_callbacks.md | |
parent | 6a91a3307ff6556225ab8717617074cea20222e0 (diff) | |
parent | 2c8bc2cdcdb7b144b7a583d24922fd8064bcff3d (diff) | |
download | rails-c989a18a74d970be86c537766f14916bd06fe176.tar.gz rails-c989a18a74d970be86c537766f14916bd06fe176.tar.bz2 rails-c989a18a74d970be86c537766f14916bd06fe176.zip |
Merge pull request #12155 from jetthoughts/reformat_guides_code_examples
Use Ruby on Rails Coding Conventions for code examples in the guides
Diffstat (limited to 'guides/source/active_record_callbacks.md')
-rw-r--r-- | guides/source/active_record_callbacks.md | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/guides/source/active_record_callbacks.md b/guides/source/active_record_callbacks.md index 95eb84dd1f..aa2ce99f6d 100644 --- a/guides/source/active_record_callbacks.md +++ b/guides/source/active_record_callbacks.md @@ -35,11 +35,11 @@ class User < ActiveRecord::Base before_validation :ensure_login_has_a_value protected - def ensure_login_has_a_value - if login.nil? - self.login = email unless email.blank? + def ensure_login_has_a_value + if login.nil? + self.login = email unless email.blank? + end end - end end ``` @@ -65,13 +65,13 @@ class User < ActiveRecord::Base after_validation :set_location, on: [ :create, :update ] protected - def normalize_name - self.name = self.name.downcase.titleize - end + def normalize_name + self.name = self.name.downcase.titleize + end - def set_location - self.location = LocationService.query(self) - end + def set_location + self.location = LocationService.query(self) + end end ``` |