Sha256: e75c34221c310fab53badd235da0d98bf41e9daca317a648694e6b5a9498e206

Contents?: true

Size: 785 Bytes

Versions: 16

Compression:

Stored size: 785 Bytes

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 :post_image

    # Relationships
    has_and_belongs_to_many :categories, class_name: "Article::Category", :join_table => "phcdevworks_press_categories_posts"
    belongs_to :user, class_name: "PhcdevworksAccounts::User"

    # Form Fields Validation
    validates :post_title,
      presence: true

    validates :post_text,
      presence: true

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

    def phcdev_article_post_nice_urls
      [:post_title]
    end

  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
phcdevworks_press-4.9.0 app/models/phcdevworks_press/article/post.rb
phcdevworks_press-4.8.2 app/models/phcdevworks_press/article/post.rb
phcdevworks_press-4.8.1 app/models/phcdevworks_press/article/post.rb
phcdevworks_press-4.8.0 app/models/phcdevworks_press/article/post.rb
phcdevworks_press-4.7.0 app/models/phcdevworks_press/article/post.rb
phcdevworks_press-4.6.0 app/models/phcdevworks_press/article/post.rb
phcdevworks_press-4.5.0 app/models/phcdevworks_press/article/post.rb
phcdevworks_press-4.4.0 app/models/phcdevworks_press/article/post.rb
phcdevworks_press-4.3.0 app/models/phcdevworks_press/article/post.rb
phcdevworks_press-4.2.0 app/models/phcdevworks_press/article/post.rb
phcdevworks_press-4.0.0 app/models/phcdevworks_press/article/post.rb
phcdevworks_press-3.1.1 app/models/phcdevworks_press/article/post.rb
phcdevworks_press-3.1.0 app/models/phcdevworks_press/article/post.rb
phcdevworks_press-3.0.2 app/models/phcdevworks_press/article/post.rb
phcdevworks_press-3.0.1 app/models/phcdevworks_press/article/post.rb
phcdevworks_press-3.0.0 app/models/phcdevworks_press/article/post.rb