Sha256: 95f8d1d744b7b66aa5c232b40d03bfa72245e753d6294d44bd65dc3364b204c9

Contents?: true

Size: 556 Bytes

Versions: 4

Compression:

Stored size: 556 Bytes

Contents

module PhcdevworksTutorials
  class Tutorial::Post < ApplicationRecord

    # Clean URL Initialize
    extend FriendlyId

    # Relationships
    belongs_to :category, class_name: 'PhcdevworksTutorials::Tutorial::Category'

    # Form Fields Validation
    validates :tutorial_post_title,
      presence: true

    validates :tutorial_post_text,
      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

4 entries across 4 versions & 1 rubygems

Version Path
phcdevworks_tutorials-1.0.1 app/models/phcdevworks_tutorials/tutorial/post.rb
phcdevworks_tutorials-1.0.0 app/models/phcdevworks_tutorials/tutorial/post.rb
phcdevworks_tutorials-0.5.0 app/models/phcdevworks_tutorials/tutorial/post.rb
phcdevworks_tutorials-0.4.0 app/models/phcdevworks_tutorials/tutorial/post.rb