Sha256: 7dd61d9cfdd33a5d62f3f6959dff7dd1cfd7b5c11f052948295fde257b2b6368

Contents?: true

Size: 865 Bytes

Versions: 3

Compression:

Stored size: 865 Bytes

Contents

module PhcdevworksPress
  class List::Item < ApplicationRecord

    # Clean URL Initialize
    extend FriendlyId

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

    # Image Upload
    has_one_attached :list_item_image

    # Relationships
    belongs_to :user, class_name: "PhcdevworksAccountsDevise::User"
    belongs_to :post, class_name: "PhcdevworksPress::List::Post"
    belongs_to :optimization, class_name: "PhcdevworksCoreModules::Marketing::Optimization", optional: true

    # Form Fields Validation
    validates :list_item_title,
      presence: true

    validates :list_item_text,
      presence: true

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

    def list_item_nice_urls
      [:list_item_title]
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
phcdevworks_press-9.0.2 app/models/phcdevworks_press/list/item.rb
phcdevworks_press-9.0.1 app/models/phcdevworks_press/list/item.rb
phcdevworks_press-9.0.0 app/models/phcdevworks_press/list/item.rb