Sha256: 9c8eaeebdb22bf2a217cc174ad0e0d5341f6e6f8a75f55c20f499be2e099713b

Contents?: true

Size: 931 Bytes

Versions: 46

Compression:

Stored size: 931 Bytes

Contents

module RocketCMS
  module Models
    module Mongoid
      module News
        extend ActiveSupport::Concern
        unless RocketCMS.configuration.news_image_styles.nil?
          include ::Mongoid::Paperclip
        end
        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

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

Version data entries

46 entries across 46 versions & 2 rubygems

Version Path
rocket_cms-0.7.1 lib/rocket_cms/models/mongoid/news.rb
ack_rocket_cms-0.7.6.3 lib/rocket_cms/models/mongoid/news.rb
ack_rocket_cms-0.7.6.2 lib/rocket_cms/models/mongoid/news.rb
ack_rocket_cms-0.7.6.1 lib/rocket_cms/models/mongoid/news.rb
ack_rocket_cms-0.7.6 lib/rocket_cms/models/mongoid/news.rb
rocket_cms-0.7.0 lib/rocket_cms/models/mongoid/news.rb
rocket_cms-0.6.18 lib/rocket_cms/models/mongoid/news.rb
rocket_cms-0.6.17 lib/rocket_cms/models/mongoid/news.rb
rocket_cms-0.6.16 lib/rocket_cms/models/mongoid/news.rb
ack_rocket_cms-0.7.5.2 lib/rocket_cms/models/mongoid/news.rb
rocket_cms-0.6.15 lib/rocket_cms/models/mongoid/news.rb
rocket_cms-0.6.14 lib/rocket_cms/models/mongoid/news.rb
ack_rocket_cms-0.7.5.1 lib/rocket_cms/models/mongoid/news.rb
rocket_cms-0.6.13 lib/rocket_cms/models/mongoid/news.rb
ack_rocket_cms-0.7.5 lib/rocket_cms/models/mongoid/news.rb
ack_rocket_cms-0.7.4.1 lib/rocket_cms/models/mongoid/news.rb
ack_rocket_cms-0.7.4 lib/rocket_cms/models/mongoid/news.rb
rocket_cms-0.6.12 lib/rocket_cms/models/mongoid/news.rb
ack_rocket_cms-0.7.3 lib/rocket_cms/models/mongoid/news.rb
ack_rocket_cms-0.7.2.4 lib/rocket_cms/models/mongoid/news.rb