Sha256: ec2a99fb0b692729a758b719971ffcfbc06efb570e504ec12f89b32a2bc99eda

Contents?: true

Size: 999 Bytes

Versions: 3

Compression:

Stored size: 999 Bytes

Contents

module PhcdevworksPress
  class Review::Post < ApplicationRecord

    # Clean URL Initialize
    extend FriendlyId

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

    # Image Upload
    has_one_attached :review_post_image

    # Relationships
    belongs_to :user, class_name: "PhcdevworksAccountsDevise::User"
    has_and_belongs_to_many :categories, class_name: "PhcdevworksCoreModules::Post::Category", :join_table => "phcdevworks_press_review_categories_posts", :dependent => :destroy
    belongs_to :optimization, class_name: "PhcdevworksCoreModules::Marketing::Optimization", optional: true

    # Form Fields Validation
    validates :review_post_title,
      presence: true

    validates :review_post_text,
      presence: true

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

    def article_review_nice_urls
      [:review_post_text]
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
phcdevworks_press-9.0.2 app/models/phcdevworks_press/review/post.rb
phcdevworks_press-9.0.1 app/models/phcdevworks_press/review/post.rb
phcdevworks_press-9.0.0 app/models/phcdevworks_press/review/post.rb