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