Sha256: 7beaa2c6820911e54876fe78642bdc5a1a771cc0c2458c9dc6654a4b04874945

Contents?: true

Size: 431 Bytes

Versions: 1

Compression:

Stored size: 431 Bytes

Contents

module Transit
  module Package
    module Post::Validations
      extend ActiveSupport::Concern
      
      included do
        validates :title, presence: true
        validates :slug, presence: { if: lambda{ |p| p.published? }, allow_blank: false }
        validates :slug, uniqueness: { if: lambda{ |p| p.published? }, scope: :_type, message: "A post already exists with this exact title." }
      end
      
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
transit-0.0.2 lib/transit/package/post/validations.rb