Sha256: 0b435abf2c212c7989d0d47a4dd42b3c8a1feb79e86ce3e07eaf907ed562f963

Contents?: true

Size: 993 Bytes

Versions: 13

Compression:

Stored size: 993 Bytes

Contents

module RocketCMS
  module Models
    module Mongoid
      module News
        extend ActiveSupport::Concern
        unless RocketCMS.configuration.news_image_styles.nil?
          include ::Mongoid::Paperclip
        end
        include ManualSlug
        included do
          field :time, type: Time
          index({enabled: 1, time: 1})
          unless RocketCMS.configuration.news_image_styles.nil?
            has_mongoid_attached_file :image, styles: RocketCMS.configuration.news_image_styles
            validates_attachment_content_type :image, content_type: %w(image/gif image/jpeg image/jpg image/png), if: :image?
          end

          field :excerpt, type: String, localize: RocketCMS.configuration.localize
          field :content, type: String, localize: RocketCMS.configuration.localize
          manual_slug :report_slug

          scope :after_now, -> { where(:time.lt => Time.now) }
          scope :by_date, -> { desc(:time) }
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
rocket_cms-0.5.12 lib/rocket_cms/models/mongoid/news.rb
rocket_cms-0.5.11 lib/rocket_cms/models/mongoid/news.rb
rocket_cms-0.5.10 lib/rocket_cms/models/mongoid/news.rb
rocket_cms-0.5.9 lib/rocket_cms/models/mongoid/news.rb
rocket_cms-0.5.8 lib/rocket_cms/models/mongoid/news.rb
rocket_cms-0.5.7 lib/rocket_cms/models/mongoid/news.rb
rocket_cms-0.5.6 lib/rocket_cms/models/mongoid/news.rb
rocket_cms-0.5.5 lib/rocket_cms/models/mongoid/news.rb
rocket_cms-0.5.4 lib/rocket_cms/models/mongoid/news.rb
rocket_cms-0.5.3 lib/rocket_cms/models/mongoid/news.rb
rocket_cms-0.5.2 lib/rocket_cms/models/mongoid/news.rb
rocket_cms-0.5.1 lib/rocket_cms/models/mongoid/news.rb
rocket_cms-0.5.0 lib/rocket_cms/models/mongoid/news.rb