Sha256: 0b5ed1752c81149eaa4fd8f74febf5a2debda3917dc8d0098f9e82fa8d712e24

Contents?: true

Size: 589 Bytes

Versions: 9

Compression:

Stored size: 589 Bytes

Contents

# encoding: utf-8
module Sunrise
  module Models
    module Page
      def self.included(base)
        base.send :include, InstanceMethods
        base.send :extend,  ClassMethods
      end
      
      module ClassMethods
        def self.extended(base)
          base.class_eval do
            belongs_to :structure
            validates_presence_of :title, :content
          end
        end
      end
      
      module InstanceMethods
        def content_without_html
          return nil if self.content.blank?
          self.content.no_html
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
sunrise-core-0.2.2 lib/sunrise/models/page.rb
sunrise-core-0.2.1 lib/sunrise/models/page.rb
sunrise-core-0.2.0 lib/sunrise/models/page.rb
sunrise-core-0.1.5 lib/sunrise/models/page.rb
sunrise-core-0.1.4 lib/sunrise/models/page.rb
sunrise-core-0.1.3 lib/sunrise/models/page.rb
sunrise-core-0.1.2 lib/sunrise/models/page.rb
sunrise-core-0.1.1 lib/sunrise/models/page.rb
sunrise-core-0.1.0 lib/sunrise/models/page.rb