Sha256: c32f670aad67ec8850e88813d933241195812de83355a5dfe9c76a1ceebfaeb2

Contents?: true

Size: 1.06 KB

Versions: 10

Compression:

Stored size: 1.06 KB

Contents

module PhcdevworksPress
  class Article::Post < ApplicationRecord

    # Clean URL Initialize
    extend FriendlyId

    # Paper Trail Initialize
    has_paper_trail :class_name => "PhcdevworksPress::ArticlePostVersions"

    # Image Upload
    has_one_attached :article_post_image

    # Relationships
    belongs_to :user, class_name: "PhcdevworksAccounts::User"
    has_and_belongs_to_many :categories, class_name: "PhcdevworksCoreModules::Post::Category", :join_table => "phcdevworks_press_article_categories_posts", :dependent => :destroy
    belongs_to :optimization, class_name: "PhcdevworksCoreModules::Marketing::Optimization", optional: true
    belongs_to :link, class_name: "PhcdevworksCoreModules::Affiliate::Link", optional: true

    # Form Fields Validation
    validates :article_post_title,
      presence: true

    validates :article_post_text,
      presence: true

    # Clean URL Define
    friendly_id :list_post_imagearticle_post_nice_urls, use: [:slugged, :finders]

    def list_post_imagearticle_post_nice_urls
      [:article_post_title]
    end

  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
phcdevworks_press-8.3.1 app/models/phcdevworks_press/article/post.rb
phcdevworks_press-8.3.0 app/models/phcdevworks_press/article/post.rb
phcdevworks_press-8.2.4 app/models/phcdevworks_press/article/post.rb
phcdevworks_press-8.2.3 app/models/phcdevworks_press/article/post.rb
phcdevworks_press-8.2.2 app/models/phcdevworks_press/article/post.rb
phcdevworks_press-8.2.1 app/models/phcdevworks_press/article/post.rb
phcdevworks_press-8.2.0 app/models/phcdevworks_press/article/post.rb
phcdevworks_press-8.1.1 app/models/phcdevworks_press/article/post.rb
phcdevworks_press-8.1.0 app/models/phcdevworks_press/article/post.rb
phcdevworks_press-8.0.2 app/models/phcdevworks_press/article/post.rb