Moved validators and hooks to the top of Web to promote their visibility

visibility
This commit is contained in:
James Herdman 2009-08-29 15:05:36 -04:00
parent 23dae8b155
commit 09531ce777

View file

@ -6,6 +6,19 @@ class Web < ActiveRecord::Base
has_many :revisions, :through => :pages has_many :revisions, :through => :pages
## Hooks
before_save :sanitize_markup
after_save :create_files_directory
before_validation :validate_address
## Validations
validates_uniqueness_of :address
validates_length_of :color, :in => 3..6
## Methods ## Methods
def wiki def wiki
@ -161,11 +174,6 @@ class Web < ActiveRecord::Base
end end
protected protected
before_save :sanitize_markup
after_save :create_files_directory
before_validation :validate_address
validates_uniqueness_of :address
validates_length_of :color, :in => 3..6
def sanitize_markup def sanitize_markup
self.markup = markup.to_s self.markup = markup.to_s