socialforge/app/models/training_task.rb

21 lines
893 B
Ruby

class TrainingTask < ActiveRecord::Base
attr_accessible :description, :project_id, :subject, :tracker_id
belongs_to :project,:touch=> true
belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
belongs_to :tracker
has_many :journals, :as => :journalized, :dependent => :destroy
has_many :visible_journals,
:class_name => 'Journal',
:as => :journalized,
:conditions => Proc.new {
["(#{Journal.table_name}.private_notes = ? OR (#{Project.allowed_to_condition(User.current, :view_private_notes)}))", false]
},
:readonly => true
has_many :praise_tread, as: :praise_tread_object, dependent: :destroy
has_one :praise_tread_cache, as: :object, dependent: :destroy
acts_as_attachable
validates_presence_of :subject, :author
validates_length_of :subject, :maximum => 255
end