Ruby On Rails Project

[Solved] Ruby On Rails Project | Ruby - Code Explorer | yomemimo.com
Question : ruby on rails project

Answered by : asraful-islam

class Article < ApplicationRecord belongs_to :author, default: -> { Current.user } has_many :comments has_one_attached :avatar has_rich_text :content, encrypted: true enum status: [ :drafted, :published ] scope :recent, -> { order(created_at: :desc).limit(25) } after_save_commit :deliver_later, if: :published? def byline "Written by #{author.name} on #{created_at.to_s(:short)}" end def deliver_later Article::DeliveryJob.perform_later self end
end

Source : | Last Update : Fri, 13 May 22

Answers related to ruby on rails project

Code Explorer Popular Question For Ruby