Sha256: ad1cc1a7cc0a4b8ac6a1638d2e346cf372c99557c018acaf1c84a2b9a74a6236

Contents?: true

Size: 1 KB

Versions: 17

Compression:

Stored size: 1 KB

Contents

module PhcdevworksTutorials
  class Command::Post < ApplicationRecord

    # Clean URL Initialize
    extend FriendlyId

    # Paper Trail Initialize
    has_paper_trail :class_name => 'PhcdevworksTutorials::CommandPostVersions'

    # Image Upload
    has_one_attached :command_post_image

    # Relationships
    belongs_to :user, class_name: "PhcdevworksAccounts::User"
    belongs_to :optimization, class_name: "PhcdevworksCoreModules::Marketing::Optimization", optional: true
    has_and_belongs_to_many :categories, class_name: "PhcdevworksCoreModules::Post::Category", :join_table => "phcdevworks_tutorials_command_categories_posts"
    has_many :items, class_name: "Command::Item", :dependent => :destroy

    # Form Fields Validation
    validates :command_post_title,
      presence: true

    validates :command_post_text,
      presence: true

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

    def command_post_nice_urls
      [:command_post_title]
    end

  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
phcdevworks_tutorials-12.1.1 app/models/phcdevworks_tutorials/command/post.rb
phcdevworks_tutorials-12.1.0 app/models/phcdevworks_tutorials/command/post.rb
phcdevworks_tutorials-12.0.5 app/models/phcdevworks_tutorials/command/post.rb
phcdevworks_tutorials-12.0.4 app/models/phcdevworks_tutorials/command/post.rb
phcdevworks_tutorials-12.0.3 app/models/phcdevworks_tutorials/command/post.rb
phcdevworks_tutorials-12.0.2 app/models/phcdevworks_tutorials/command/post.rb
phcdevworks_tutorials-12.0.1 app/models/phcdevworks_tutorials/command/post.rb
phcdevworks_tutorials-12.0.0 app/models/phcdevworks_tutorials/command/post.rb
phcdevworks_tutorials-11.3.0 app/models/phcdevworks_tutorials/command/post.rb
phcdevworks_tutorials-11.2.0 app/models/phcdevworks_tutorials/command/post.rb
phcdevworks_tutorials-11.1.0 app/models/phcdevworks_tutorials/command/post.rb
phcdevworks_tutorials-11.0.2 app/models/phcdevworks_tutorials/command/post.rb
phcdevworks_tutorials-11.0.1 app/models/phcdevworks_tutorials/command/post.rb
phcdevworks_tutorials-11.0.0 app/models/phcdevworks_tutorials/command/post.rb
phcdevworks_tutorials-10.0.0 app/models/phcdevworks_tutorials/command/post.rb
phcdevworks_tutorials-9.0.1 app/models/phcdevworks_tutorials/command/post.rb
phcdevworks_tutorials-9.0.0 app/models/phcdevworks_tutorials/command/post.rb