Sha256: 21a1543dea42b635467ecfbbcf323cf818a23ba297b526c14b9c2a7e6d389170

Contents?: true

Size: 633 Bytes

Versions: 1

Compression:

Stored size: 633 Bytes

Contents

module PhcdevworksTutorials
  class Tutorial::Post < ApplicationRecord

    # Clean URL Initialize
    extend FriendlyId

    # Image Upload
    has_one_attached :tutorial_post_image

    # 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

1 entries across 1 versions & 1 rubygems

Version Path
phcdevworks_tutorials-1.2.1 app/models/phcdevworks_tutorials/tutorial/post.rb