Sha256: 3dcbc92c7ea57f9c7205c3f7c35e22fa297db4b5c16470b32e3f8775de81ff07

Contents?: true

Size: 821 Bytes

Versions: 15

Compression:

Stored size: 821 Bytes

Contents

module RocketCMS
  module Models
    module ActiveRecord
      module News
        extend ActiveSupport::Concern
        included do
          extend FriendlyId

          unless RocketCMS.configuration.news_image_styles.nil?
            has_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
          friendly_id :report_slug, use: [:slugged, :finders]

          has_paper_trail

          validates_lengths_from_database only: [:name, :title, :content, :excerpt, :h1, :keywords, :robots, :og_title]

          scope :after_now, -> { where("time < ?", Time.now) }
          scope :by_date, -> { order(time: :desc) }
        end
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

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