Module: Sunrise::Models::Post::ClassMethods

Defined in:
lib/sunrise/models/post.rb

Class Method Summary collapse

Class Method Details

.extended(base) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/sunrise/models/post.rb', line 11

def self.extended(base)
  base.send(:include, Utils::Header)
  base.class_eval do
    belongs_to :structure
    
    validates_presence_of :title, :content
    
    scope :with_title, lambda {|title| where(["title LIKE ?", "%#{title}%"]) }
	
   before_save :make_date
  end
end