Sha256: ba5c8de888766d73587d2b1c5b4fc22753488ee422e295d4bb1b51328d5a2989
Contents?: true
Size: 962 Bytes
Versions: 2
Compression:
Stored size: 962 Bytes
Contents
module RocketCMS module Models module Mongoid module News extend ActiveSupport::Concern include FilenameToSlug 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ack_rocket_cms-0.7.2.3.1 | lib/rocket_cms/models/mongoid/news.rb |
ack_rocket_cms-0.7.2.3 | lib/rocket_cms/models/mongoid/news.rb |