Soc/app/models/learning_goal.rb

19 lines
425 B
Ruby
Raw Normal View History

2024-01-06 09:42:36 +00:00
class LearningGoal < ApplicationRecord
belongs_to :user
2024-01-06 10:29:41 +00:00
has_rich_text :description
has_rich_text :retrospective
2024-01-07 13:22:21 +00:00
validates :completed, inclusion: { in: [true, false] }
2024-01-06 09:42:36 +00:00
validates :title, presence: true
2024-01-06 11:10:56 +00:00
has_and_belongs_to_many :tags
accepts_nested_attributes_for :tags
def microposts
microposts = Micropost.none
tags.each { |tag| microposts = microposts.or(tag.microposts) }
microposts
end
2024-01-06 09:42:36 +00:00
end