Sha256: 397ed3048d3d805308b9c79cb5666ad60b007406beb20ae7d005f0a2a9344559

Contents?: true

Size: 634 Bytes

Versions: 2

Compression:

Stored size: 634 Bytes

Contents

module PhcdevworksTutorials
  class Tutorial::Post < ApplicationRecord

    # Clean URL Initialize
    extend FriendlyId

    # Image Upload
    has_one_attached :tutorial_post_images

    # Relationships
    belongs_to :category, class_name: 'PhcdevworksTutorials::Tutorial::Category'
    has_many :steps, class_name: "PhcdevworksTutorials::Tutorial::Step"

    # Form Fields Validation
    validates :tutorial_post_title,
      presence: true

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

    def phcdev_tutorials_post_nice_urls
      [:tutorial_post_title]
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
phcdevworks_tutorials-1.2.0 app/models/phcdevworks_tutorials/tutorial/post.rb
phcdevworks_tutorials-1.1.1 app/models/phcdevworks_tutorials/tutorial/post.rb