Sha256: 240b5e624148a7cb371f3cfc3bee74cfe74b73baa9dd79b8fb89baa7dbd46d01

Contents?: true

Size: 867 Bytes

Versions: 10

Compression:

Stored size: 867 Bytes

Contents

module RocketCMS
  module Models
    module ActiveRecord
      module News
        extend ActiveSupport::Concern
        included do
          if !RocketCMS.config.news_image_styles.nil?
            if RocketCMS.shrine?
              include NewsUploader.attachment(:image)
            elsif RocketCMS.paperclip?
              has_attached_file :image, styles: RocketCMS.config.news_image_styles
            end
          end

          has_paper_trail if respond_to?(: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) }

          if RocketCMS.config.localize
            translates :name, :excerpt, :content
          end
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
rocket_cms-0.37.1 lib/rocket_cms/models/active_record/news.rb
rocket_cms-0.37.0 lib/rocket_cms/models/active_record/news.rb
rocket_cms-0.36.0 lib/rocket_cms/models/active_record/news.rb
rocket_cms-0.35.0 lib/rocket_cms/models/active_record/news.rb
rocket_cms-0.34.0 lib/rocket_cms/models/active_record/news.rb
rocket_cms-0.33.1 lib/rocket_cms/models/active_record/news.rb
rocket_cms-0.33.0 lib/rocket_cms/models/active_record/news.rb
rocket_cms-0.32.0 lib/rocket_cms/models/active_record/news.rb
rocket_cms-0.31.1 lib/rocket_cms/models/active_record/news.rb
rocket_cms-0.31.0 lib/rocket_cms/models/active_record/news.rb